I’ve just started working with Rails. And I can’t figure out what
seems to be the easiest thing imaginable. I need to send @ferry.id
from a view in ferry_controller…
You can create an instance variable the same as you do with the
schedule. @ferry_id = params[:ferry_id]
If the ferry_id is part of the schedule, then you might want to create
the Schedule object with the ferry id @schedule = Schedule.new :ferry_id => params[:ferry_id]
In either case you’ll need a hidden tag on the new page, so the param
gets passed into the create action. If you do things the second way
you just do
<%= f.hidden_field :ferry_id %>
Thanks for the quick reply. I’m still not sure how the @ferry_id
travels from my ferry_controller’s view to the schedule_controller.
Is it something like this:
I came from C# and .net and it seems to me that the syntax in Ruby and
Rails is less clear. I’ve only been at it for a week
though…probably just need more time to let it soak in.
Thanks for the help, Pat.
Gavin
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.