Reputation: 45074
I have a class called Appointment
that has, among other attributes, start_time
.
In my form, I'm not using start_time
directly. I'm separating it into start_time_time
(I know it's an awkward name) and start_time_ymd
. My goal is to combine start_time_ymd
and start_time_time
into a complete start_time
. (I'm doing this because I don't like the UI for the helper that comes with a date field.)
The error I'm getting is unknown attribute: start_time_time
, which is of course not surprising because Appointment
doesn't have any attribute called start_time_time
.
If start_time_time
were something from a related model, I could just do something like accepts_nested_attributes_for :whatever
, but since it's not, that wouldn't make sense.
How can I do what I'm trying to do? (I'm a Rails noob so you might have to spoon-feed it to me.)
Upvotes: 0
Views: 1760
Reputation: 17724
You could try this in your model:
attr_accessible :start_time_time, :start_time_ymd
Upvotes: 1
Reputation: 12165
I think using a virtual attribute (text version) is your best bet.
Upvotes: 1