Its the tutorial http://railstutorial.org/

On Feb 5, 9:51 pm, Frederick Cheung <[email protected]>
wrote:
> On 5 Feb 2011, at 18:09, Filippos <[email protected]> wrote:
>
> > Hello
>
> > Finished reading chapter 9 and im a little bit confused.
>
> Not familiar with that particular tutorial but ...
>
> > 1. In the tutorial, Modules are used instead of creating a Model and
> > working in a class inside a module , like in authenticating passwords.
> > Wouldn't that be possible? Or is it unnecessary since we're not
> > messing with a database in terms of storing data?
>
> Not sure what you are getting at there.
>
>
>
> > 2. what is the difference between session[:remember_token] = user.id
> > and cookies[:remember_token] ?
> > Session stores the cookie locally until we exit the browser and then
> > it gets deleted whereas cookies is permanent stored even after we exit
> > the browser?
>
> Sessions are stored using cookies (either in the cookie itself or by having a 
> cookie that points at something in the database or memcache). The cookie 
> supporting a session is set to expire when the browser quits whereas 'normal' 
> cookies need not be. Also, rails handles serialising arbitrary ruby objects 
> into the session, I don't think it will do that for cookie values.
>
> > 3. In section 9.3.3 we are being introduced to the curent user with
> > the code in the module SessionsHelper
> > self.current_user = user
>
> > Why do we use the "self"? and not just current_user since we use it as
> > a variable object and not as an object attribute ? Or is it a way to
> > say sessions.current_user = user ?
>
> If you didn't then it would just be creating a local variable called 
> current_user, rather than calling the current_user= method
>
> > 4. What's the purpose of def current_user=(user) and of def
> > current_user in listing 9.16 ? Couldnt we avoid all that using a
> > single method?
>
> One's the setter method, the other is the getter. Doesn't seem like much 
> point is combining the two.
>
> Fred
>
>
>
> > Thank you in advance!
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to 
> > [email protected].
> > For more options, visit this group 
> > athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to