Hello, I''ve started using datebocks yesterday, it seems amazing to me, but I have some problems I can''t solve. When I show a model''s date I do: <%= datebocks_field(''backup'', ''bkdate'') %> But the field in the database is a datetime so datebocks show me a date as 2001/01/24 00:00:00 and I don''t want to see the time, only the date. How do I tell datebocks to use another format? --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Morover I''ve seen a bug: When you show a date field with datebocks: <%= datebocks_field(''backup'', ''bkdate'') %> it shows you the date in format: 2002/11/08 00:00:00. But that''s what I said in my first post. The bug heppens when you delete the triling time and lost the focus, then it change the date to yyyy-mm-dd but it changes the value to 2008-02-11!!!!!!! --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Well, I''ve solved this situation. My model has an attribute named bkdate, yes, I know it''s a bit strange but it''s a legacy system I''m making with Rails. Then I have added two methods in the model: # To show the date in the right format def date return bkdate.strftime("%Y-%m-%d") end # This method does nothing but the framework asks for it. def date=(value) bkdate = value end In the view I''ve used date instead of bkdate: <td><%= datebocks_field(''backup'', ''date'') %></td> And finally in the controller''s update method I added this line: params[:backup][:bkdate] = params[:backup][:date] to assign the date''s value to bkdate in params hash And that''s all, it works! :) --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---