Help with time_select?

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]]


def line_of_work(line_of_work_id)

lines_of_work[line_of_work_id - 1][0]


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:

Line of work: <%= line_of_work(@company.line_of_work_id) %>

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,