Ok, I'm not as advanced as 7stud. Im not familiar with ruby and I
started studying Rails.
Your replies where very informative but also a bit confusing at the
same time.

1. So when we want to go to localhost/myapp/users/1 rails first maps
the URL to Users#show, then creates the object user_controller =
UsersController.new and then executes the user_controller.show?

2. When we assign an instance variable inside the controller , doesn't
it refer to the controller object that rails create? For example @user
-> user_controller = UsersController.new
What would the difference be between the instance variable and the
self.user inside t he controller method.

3. I didn't understand your justification of getter and setter.Since
instance variables work fine why would you need to define a setter and
getter. You can just assign to the instance variable and you're done
since it will be accessible in the controller and view for as long as
the sess_controller lasts.

Instead of self.current_user = user we could write @current_user =
user

Why call the current_user getter and not just call the @current_user
directly.

I'm a bit confused.

The easy way would be to memorize or copy/paste but understanding the
code is better way to create rails apps.

-- 
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