On 10-10-20 05:18 AM, Murph2m wrote:
Ok - Thanks so I was reading it wrong! but then all that is in the
pages_controller.rb is:
class PagesController< ApplicationController
def home
@title = "Home"
end
def contact
@title = "Contact"
end
def about
@title = "About"
end
def help
@title = "Help"
end
end
Doesn't this just define some variables? what is the action?
i assume you're reading the "ruby on rails tutorial"?, you need to
understand rails MVC conventions, i suggest you reread the early chapters =)
when a request comes in the controller is loaded and an action is run,
the controller can then request the model to fetch some data, the class
instance variables defined (those defined with @) in the controller are
accessible from the view. rails display the view following a controller
action.
request -> controller -> action -> model(optional) -> view
the view will have the same name as the action.
if you browser to 'http://ocalhost:3000/pages/home' then the Pages
controller will be loaded and it will call the home action, which will
assign a variable and then display view home.html.erb
--
Kind Regards,
Rajinder Yadav | DevMentor.org | Do Good! ~ Share Freely
GNU/Linux: 2.6.35-22-generic
Kubuntu x86_64 10.10 | KDE 4.5.1
Ruby 1.9.2p0 | Rails 3.0.1
--
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.