Ok, so the year will just be stored as information (I mean you'll just
use it to display the information on a page) no?
If it's like that you store it as a varchar or integer I think. But if
you will need to process the year in other functions well it should be
better to store it as a year.
When creating a new line on your database you can use the Date.today
function to get the current date, after the function strftime will
help you to display only the year:
@year = <your_object>.year.strftime("%Y")displaying @year in your html.erb page you'll only see the year from the date, just as you want to. On 20 feb, 17:32, Scott Holland <[email protected]> wrote: > CiriusMex wrote: > > Well actualy it depends a lot on what you wanna do with this year > > data...could you precise a little what is your goal? > > > On 20 feb, 17:02, Scott Holland <[email protected]> > > I am building a little application to manage our company holiday > entitlement. > > When adding a new user, the form will allow the admin user to enter the > holiday entitlement for next couple of years: > > e.g. > > -------------- > Name: John Smith > > Entitlement for year starting 2008: 24 [days] > Entitlement for year starting 2009: 25 [days] > ------------- > > So, in theory, my table will look like: > > ------------- > id > user_id > year > entitlement > ------------- > > -- > Posted viahttp://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

