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
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