<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ActivoRicordi Captain&#039;s log &#187; Ruby</title>
	<atom:link href="http://blog.activoricordi.com/tag/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.activoricordi.com</link>
	<description>Delivering Innovation through Technology</description>
	<lastBuildDate>Sat, 21 Jan 2012 00:56:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Create an AddressBook 1</title>
		<link>http://blog.activoricordi.com/2008/08/create-an-addressbook-1/</link>
		<comments>http://blog.activoricordi.com/2008/08/create-an-addressbook-1/#comments</comments>
		<pubDate>Tue, 26 Aug 2008 23:59:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Mashups]]></category>
		<category><![CDATA[RubyonRails]]></category>
		<category><![CDATA[address book]]></category>
		<category><![CDATA[Rails 2.0]]></category>
		<category><![CDATA[RoR]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.activoricordi.com/?p=6</guid>
		<description><![CDATA[Most of the articles and projects about Ruby on Rails do not cover the whole process of creating an open source slim project, the objective of these set of posts if cover the whole development process]]></description>
			<content:encoded><![CDATA[<p>Hi All:</p>
<p>One of the things I dislike most of Open Source Applications, it is that are very difficult to continue since the code and way it is built, also it does not cover components; instead of building new entire application I would like to see how to build small reusable components which could be integrated on new applications. Today, we are going to explain how to create a slik &#8220;address book&#8221;.</p>
<p><strong>1) Create the rails project:</strong></p>
<p>As I am a fan of mysql database, I do create projects specifically for this database with the sentence:</p>
<p><code>rails -d mysql addressbook</code></p>
<p><strong>2) Create main objects:</strong></p>
<p>The base of the addressbook is the contact object which we are going to scaffold:</p>
<p><code>script/generate scaffold contact firstname:string lastname:string lastname2:string phone_id:integer address_id:integer photo_id:integer page_url:string title:string company_id:integer email_id:integer background:text comments:text author:string</code></p>
<p>As you can see the Contact is compound by other objects such as phone, address and photo. These objects are formed by several characteristics:</p>
<ul>
<li>firstname</li>
<li>lastname</li>
<li>lastname2 &#8211; For those countries where a second last name is used</li>
<li>phone_id &#8211; Each contact can have multiple phone which forms an array of values</li>
<li>address_id- The address could be multiple and build on an object with an array of values</li>
<li>comments &#8211; It has an auto-complete feature</li>
</ul>
<p>3) Create authentication:</p>
<p>We are going to create the authentication, so only authorized users can access to the application</p>
<p>script/generate scaffold user userName:string firstName:string lastName:string alias:string email:string password_salt:string password_hash:string</p>
<p>4) Setup the database:</p>
<p>We open the database.yml file where we insert the password of the root user or if we have leave it blank as default we do not have to enter it. In order to look it, install a mysql administration tool. There are plenty on the Internet.</p>
<p>We execute the rake command to create the database</p>
<p><code>rake create:db:all</code></p>
<p>And we create the first migration</p>
<p><code>rake migrate:db</code></p>
<p>Now we have created the contact object on the database.</p>
<p>On next chapter, we will create the rest of the subornidates objects and we will add plugins.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.activoricordi.com/2008/08/create-an-addressbook-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gestión de autorizaciones y autentificaciones en RoR</title>
		<link>http://blog.activoricordi.com/2007/12/gestion-de-autorizaciones-y-autentificaciones-en-ror/</link>
		<comments>http://blog.activoricordi.com/2007/12/gestion-de-autorizaciones-y-autentificaciones-en-ror/#comments</comments>
		<pubDate>Sun, 02 Dec 2007 18:46:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[RubyonRails]]></category>
		<category><![CDATA[Authentication]]></category>
		<category><![CDATA[Authorization]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.activoricordi.com/?p=3</guid>
		<description><![CDATA[Una de las mejores cosas que tiene &#8220;Rails&#8221; es lo sencillo que es gestionar todas las autorizaciones y la autentificación de los usuarios además de la razonable cantidad de &#8220;plugins&#8221; ya escritos. En cierta manera, aunque pueda parecer muy restrictivo sería genial que estuviese contenido ya dentro del mismo &#8220;framework&#8221; como un gestor de usuarios, [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="line-height: normal"><span style="font-size: 12pt; font-family: 'Times New Roman','serif';">Una de las mejores cosas que tiene &#8220;<em>Rails</em>&#8221; es lo sencillo que es gestionar todas las autorizaciones y la autentificación de los usuarios además de la razonable cantidad de &#8220;<em>plugins</em>&#8221; ya escritos. En cierta manera, aunque pueda parecer muy restrictivo sería genial que estuviese contenido ya dentro del mismo &#8220;<em>framework</em>&#8221; como un gestor de usuarios, roles y grupos.</span></p>
<p class="MsoNormal" style="line-height: normal"><span style="font-size: 12pt; font-family: 'Times New Roman','serif';">De cualquier manera existe ya un plugin denominado RESTful Authenticated (versión nueva del Act_as_Authenticated) que nos ahorra mucho trabajo y que fácilmente podemos adaptar para administrar el resto del sistema de autorizaciones y autenticación.</span></p>
<p class="MsoNormal" style="line-height: normal"><span style="font-size: 12pt; font-family: 'Times New Roman','serif';">1.Obviamente lo primero que hemos de hacer será instalar el plugin &#8220;RESTful authentication&#8221; en nuestra aplicación, se trata de un paso sencillo.</span></p>
<p class="MsoNormal" style="line-height: normal"><span style="font-size: 12pt; font-family: 'Times New Roman','serif';">2.- Autentificación del Usuario:</span></p>
<p class="MsoNormal" style="line-height: normal"><span style="font-size: 12pt; font-family: 'Times New Roman','serif';">&#8220;<em>RESTful authentication</em>&#8221; es un generador que nos va permitir crear el modelo y el controlador que va a realizar la gestión de la autentificación del usuario.</span></p>
<p class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New';">ruby script/generate authenticated user account</span><span style="font-size: 12pt; font-family: 'Times New Roman','serif';"><br />
</span><span style="font-size: 10pt; font-family: 'Courier New';">rake db:migrate</span><span style="font-size: 12pt; font-family: 'Times New Roman','serif';"><br />
Si estamos utilizando RadRails, iremos a la pestaña de Generators una vez bajado e instalado el plugin, y introduciremos &#8220;<em>authenticated</em>&#8221; dem<br />
&#8216;user&#8217; es el nombre del modelo que vamos a utilizar para guardar los datos de autentificación del usuario, además creamos el nombre del controlador que va a gestionar la autentificación en este caso vamos a llamarlo &#8216;account&#8217;, pero podemos llamarlo &#8216;cuenta&#8217;,'acceso&#8217; o el nombre que le queramos dar.</span></p>
<p class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New';">./script/generate authenticated <em>&lt;usermodelname&gt;</em> <em>&lt;controllername&gt;</em></span></p>
<pre>./script/generate authenticated user sessions</pre>
<p class="MsoNormal" style="line-height: normal"><span style="font-size: 12pt; font-family: 'Times New Roman','serif';">Esto no creara un modelo &#8216;user&#8217; o &#8216;usuario&#8217; y un controlador que se denominara &#8216;account&#8217; en que luego entraremos a para adaptarlo a nuestro intereses</span></p>
<p class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New';">./script/generate authenticated user account \&#8211;include-activation</span></p>
<p class="MsoNormal" style="line-height: normal"><span style="font-size: 12pt; font-family: 'Times New Roman','serif';">Mediante el generador se crearan automáticamente los siguientes recursos:</span></p>
<p class="MsoNormalCxSpMiddle" style="line-height: normal"><span style="font-size: 10pt; font-family: 'Courier New';">exists app/models/</span><span style="font-size: 12pt; font-family: 'Times New Roman','serif';"><br />
</span><span style="font-size: 10pt; font-family: 'Courier New';">exists app/controllers/</span><span style="font-size: 12pt; font-family: 'Times New Roman','serif';"><br />
</span><span style="font-size: 10pt; font-family: 'Courier New';">exists app/controllers/</span><span style="font-size: 12pt; font-family: 'Times New Roman','serif';"><br />
</span><span style="font-size: 10pt; font-family: 'Courier New';">exists app/helpers/</span><span style="font-size: 12pt; font-family: 'Times New Roman','serif';"><br />
</span><span style="font-size: 10pt; font-family: 'Courier New';">create app/views/account</span><span style="font-size: 12pt; font-family: 'Times New Roman','serif';"><br />
</span><span style="font-size: 10pt; font-family: 'Courier New';">exists app/controllers/</span><span style="font-size: 12pt; font-family: 'Times New Roman','serif';"><br />
</span><span style="font-size: 10pt; font-family: 'Courier New';">exists app/helpers/</span><span style="font-size: 12pt; font-family: 'Times New Roman','serif';"><br />
</span><span style="font-size: 10pt; font-family: 'Courier New';">create app/views/users</span><span style="font-size: 12pt; font-family: 'Times New Roman','serif';"><br />
</span><span style="font-size: 10pt; font-family: 'Courier New';">exists test/functional/</span><span style="font-size: 12pt; font-family: 'Times New Roman','serif';"><br />
</span><span style="font-size: 10pt; font-family: 'Courier New';">exists test/functional/</span><span style="font-size: 12pt; font-family: 'Times New Roman','serif';"><br />
</span><span style="font-size: 10pt; font-family: 'Courier New';">exists test/unit/</span><span style="font-size: 12pt; font-family: 'Times New Roman','serif';"><br />
</span><span style="font-size: 10pt; font-family: 'Courier New';">create app/models/user.rb</span><span style="font-size: 12pt; font-family: 'Times New Roman','serif';"> -<br />
</span><span style="font-size: 10pt; font-family: 'Courier New';">create app/controllers/account_controller.rb</span><span style="font-size: 12pt; font-family: 'Times New Roman','serif';"><br />
</span><span style="font-size: 10pt; font-family: 'Courier New';">create app/controllers/users_controller.rb</span><span style="font-size: 12pt; font-family: 'Times New Roman','serif';"><br />
</span><span style="font-size: 10pt; font-family: 'Courier New';">create lib/authenticated_system.rb</span><span style="font-size: 12pt; font-family: 'Times New Roman','serif';"><br />
</span><span style="font-size: 10pt; font-family: 'Courier New';">create lib/authenticated_test_helper.rb</span><span style="font-size: 12pt; font-family: 'Times New Roman','serif';"><br />
</span><span style="font-size: 10pt; font-family: 'Courier New';">create test/functional/account_controller_test.rb<br />
create app/views/users/new.rhtml<br />
create test/functional/users_controller_test.rb<br />
create test/unit/user_test.rb<br />
create test/fixtures/users.yml<br />
create app/helpers/account_helper.rb<br />
create app/helpers/users_helper.rb<br />
create app/views/account/new.rhtml</span></p>
<p class="MsoNormalCxSpMiddle" style="line-height: normal">Si se utiliza el textmate existe un bundle especifico dentro del textmate que permite la instalación de plugins.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.activoricordi.com/2007/12/gestion-de-autorizaciones-y-autentificaciones-en-ror/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

