I didn''t understand the docs and neither found any videos on raiscast
so I''m
asking here.
I gotta store the opening_hours and closing_hours of a company_layout model
(which belongs_to a company model).
How can I do that with time_select? what type should it be on my database
(t.time? t.integer?)?
And how can I retrieve this information for a show view?
So far I have done this with the helpers:
def lines_of_work
[[''Clothes'', 1], [''Shoes'', 2],
[''Restaurant'', 3]]
end
def line_of_work(line_of_work_id)
lines_of_work[line_of_work_id - 1][0]
end
for my company model (and store t.integer line_of_work_id in the company
migration)
And that in the view for new company:
<%= f.label :line_of_work %>
<%= select(:company, :line_of_work_id, lines_of_work, :prompt => true)
%>
At the show view:
<p>Line of work: <%= line_of_work(@company.line_of_work_id)
%></p>
If anyone can help me with the hours stuff and maybe a better way to store
the lines of work thing I appreciate it.
Thank you,
Rodrigo
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.