mkristian
2011-Jul-10 17:57 UTC
need help for formating timestamp on round trip: db -> browser -> db
I have a date in the sqlite3 database which gives me trouble sqlite> select * from accounts; 3|myname|2011-07-10 13:47:26.055000|2011-07-10 13:47:26.055000 putting it into html via the hidden_field.tag like this <%= f.hidden_field :updated_at %> here f comes from <%= form_for(@account) do |f| %> that produces working html code as such <input id="account_updated_at" name="account[updated_at]" type="hidden" value="2011-07-10 13:47:26.055000" /> now I need to add the very some date as query parameter to an url of a link and following code works most of the time but NOT with that example from the database: <%= link_to ''Destroy'', account_path(account) + "? account[updated_at]=#{account.updated_at.utc.strftime(''%Y-%m-%d %H:%M: %S.%N'')}", :confirm => ''Are you sure?'', :method => :delete %> which produces <a href="/accounts/3?account[updated_at]=2011-07-10 13:47:26.550" data- confirm="Are you sure?" data-method="delete" rel="nofollow">Destroy</ a> this query-parameter parses into a different date then the one I have in the database - so I can not find the model in the database. background is an optimistic persistence with the help of this timestamp since I like to keep the model slim and the activerecord default would add another "version" column to it. bug ? or how does this hidden_field method does it right ? I was not able to find the right spot in the code. thanx in advance. Kristian -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.