I’ve been away from rails for a while but now wanna get back into it and
I guess my rails foo has got rusty. I’ve been wrestling with this
simple! problem for the weekend and I can’t fix it - driving me nuts.
Real cry for help.
I have a Course model which contains price_per_week.
I’d like one page where a user selects a course and a duration and then
submits this, the next page will look up the Course price and multiply
by the duration and display a quote. EASY huh, not for me this weekend !
All I need for now to get back on track is just to get the basics, how
do I pass the bl*^(*^dy Course through to the price screen… Please see
the code below. I’d be most grateful if someone can point me in the
right direction…
I recognise that the I am not passing any params at the moment from
this…
<%= link_to ‘Get a Price!’, :action => ‘price’, :id => @course %> <—
this is wrong ?
But how do I do it ?
I’ll be happy just to get the Course name displayed for now, come back
to the pricing later.
bb
VIEW
Ajax Demo <%= javascript_include_tag "prototype" %><%= collection_select(:course, :id, @courses, :id, :name, options
={:prompt => “-Select a payment”}, :class =>“course”) %>
<%= link_to ‘Get a Price!’, :action => ‘price’, :id => @course %> <—
this is wrong ?
<%= link_to ‘Reset’, :action => ‘index’ %>
========
controller
class InvoiceController < ApplicationController
def index
@enquiry = Enquiry.new
@courses = Course.active_courses
@courses = Course.active_courses
render :layout => “welcome”
end
def price
@time = Time.now
render :layout => “welcome”
@course = Course.find(:id)
@selected_course = params[course][id]
end
end
=======
Price view
<%= @time %>
Price Below
<%= @selected_course.name %>
bla bla bla to come…