2009/9/20 arwed <a...@bbp.biz>: > > Hi Colin, > > thanks for your reply. > > I defined my date formats in /config/locales/de.yml but I don't know > how to format my dates in my model. In view I can do <%=l > @schedule.start_date %>. > > Can you tell me how I can do that with #{start_date}? The format I > need is dd.mm.yyy
Have you tried #{l start_date} The #{ } syntax in a double quoted string just says drop into ruby and work out the expression between the braces. Alternatively if you always want the same format you can use #{start_date.strftime(some parameters to format it the way you want)} Colin > > Regards > Arwed > > > On 20 Sep., 21:46, Colin Law <clan...@googlemail.com> wrote: >> 2009/9/20 arwed <a...@bbp.biz>: >> >> >> >> > Hi, >> >> > I have a model with start_date and end_date and a helper: >> >> > def period >> > "#{start_date} - #{end_date}" >> >> If you want the dates to appear as localised strings you must do it >> here. Formatting them as appropriate as you build the string. If I >> understand the question correctly. >> >> Colin >> >> > end >> >> > in my view I have: >> >> > <%= f.collection_select :schedule_id, >> > @convention.schedules, :id, :period, {:selected => @schedule.id} %> >> >> > How can I show :period localized, as <%=l ... won't work. >> >> > Regards >> > Arwed >> >> > > > --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---