First thing I noticed that the root :to => "say#hello" in routes.rb worked fine once there was only 1 webpage, and once you were only using the url localhost:3000. Once I specified the whole webpage I got an error saying "something I didn'nt record". So after some googling I decided to add the following to routes.rb
do
match ':controller(/:action(/:id(.:format)))'
end
and that seems to work well as long as you specify the full url, but not the root.
So I carried on, and tried to get the links between the hello view and goodbye view working, which again wasn't happy to play. So I found the following code from google
<p><%= link_to "Goodbye", :action => 'goodbye' %></p>
and once I copied and pasted into view/hello it all seemed to work fine. My limited grasp on what's happening here, is that the controller and the view weren't talking properly to each other, and that the file route.rb is the glue that can make it all happen. According to the book it should happen automatically, but for some reason it's not and I needed to specify within the view html.erb file where it should look. It's working now, I completed the exercise, but I'm worried that the spurious code I've added will come back to bite me.
No Response to "Ruby Rails and our Chapter Two assignment"
Post a Comment