why's my course_duration being reset

Can't get this?...I'm close I think, my calculation appears to be
working, but.... when i access duration = <%= @enquiry.course_duration
%><br> in my final view it's blank.. course_duration is getting set to
null but works for the calculation?

Hard to say since you haven't said what view is involved (top tip -
pasting 200 lines of code isn't the best way to get people to read
your question. try to only include the relevant bits).
Are you under the impression that course_duration will be save to the
database? it won't (it's just a regular instance variable rather then
an activerecord attribute).

Fred

Sorry Fred,

Noted re the tip... here's a few lines from the view...

<%= @enquiry.course.name %><br>
base price per week = <%= @enquiry.course.price_per_week %><br>
duration = <%= @enquiry.course_duration %><br> <--- The Line that's
null
@enquiry.course_booking_fee : <%= @enquiry.course_booking_fee %><br>

and yes, I thought course_duration would be saved, or to put it another
way, I'd like it to be?

Sorry Fred,

Noted re the tip... here's a few lines from the view...

<%= @enquiry.course.name %><br>
base price per week = <%= @enquiry.course.price_per_week %><br>
duration = <%= @enquiry.course_duration %><br> <--- The Line that's
null
@enquiry.course_booking_fee : <%= @enquiry.course_booking_fee %><br>

and yes, I thought course_duration would be saved, or to put it
another
way, I'd like it to be?

Then it needs to be a column on your enquiries table.

Fred

Frederick Cheung wrote:

and yes, I thought course_duration would be saved, or to put it
another
way, I'd like it to be?

Then it needs to be a column on your enquiries table.

Fred

It is...that's why I don't get it?
enquiries contains a column called "course_duration" of type integer.

In that case the problem is that you've got
attr_accessor :course_duration. This is replacing the accessor methods
that read/write from the database column with one that don't (ie just
plain old ruby accessor methods backed by an instance variable)

Fred

Frederick Cheung wrote: