code_junkie

Representing a year with RoR?

Nov 12th, 2011
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.18 KB | None | 0 0
  1. YourModel.date.year # => "1999"
  2.  
  3. >> m = YourModel.create(:year => '2008')
  4.  
  5. >> m.year.to_s
  6. => "2008-01-01"
  7.  
  8. >> m = YourModel.create(:year => '2008')
  9.  
  10. >> m.year.to_s
  11. => "2008"
Add Comment
Please, Sign In to add comment