i know that title sounds confusing, but here is the deal: the two columns that we are concerned with for this question are the "updated_on" column and the "views" column. the views column increases everytime a user visits a certain page. like this: @object.update_attributes(:views => @object.views + 1) the problem is that when a user visits the page, it AUTOMATICALLY updates the "update_on" column with the current time. i don''t want this to happen. how can i rewrite this so it DOES NOT update the "update_on" column and only the "views" column? thanks eli
i know that title sounds confusing, but here is the deal: the two columns that we are concerned with for this question are the "updated_on" column and the "views" column. the views column increases everytime a user visits a certain page. like this: @object.update_attributes(:views => @object.views + 1) the problem is that when a user visits the page, it AUTOMATICALLY updates the "update_on" column with the current time. i don''t want this to happen. how can i rewrite this so it DOES NOT update the "update_on" column and only the "views" column? thanks eli
i know that title sounds confusing, but here is the deal: the two columns that we are concerned with for this question are the "updated_on" column and the "views" column. the views column increases everytime a user visits a certain page. like this: @object.update_attributes(:views => @object.views + 1) the problem is that when a user visits the page, it AUTOMATICALLY updates the "update_on" column with the current time. i don''t want this to happen. how can i rewrite this so it DOES NOT update the "update_on" column and only the "views" column? thanks eli
i know that title sounds confusing, but here is the deal: the two columns that we are concerned with for this question are the "updated_on" column and the "views" column. the views column increases everytime a user visits a certain page. like this: @object.update_attributes(:views => @object.views + 1) the problem is that when a user visits the page, it AUTOMATICALLY updates the "update_on" column with the current time. i don''t want this to happen. how can i rewrite this so it DOES NOT update the "update_on" column and only the "views" column? thanks eli
i know that title sounds confusing, but here is the deal: the two columns that we are concerned with for this question are the "updated_on" column and the "views" column. the views column increases everytime a user visits a certain page. like this: @object.update_attributes(:views => @object.views + 1) the problem is that when a user visits the page, it AUTOMATICALLY updates the "update_on" column with the current time. i don''t want this to happen. how can i rewrite this so it DOES NOT update the "update_on" column and only the "views" column? thanks eli
i know that title sounds confusing, but here is the deal: the two columns that we are concerned with for this question are the "updated_on" column and the "views" column. the views column increases everytime a user visits a certain page. like this: @object.update_attributes(:views => @object.views + 1) the problem is that when a user visits the page, it AUTOMATICALLY updates the "update_on" column with the current time. i don''t want this to happen. how can i rewrite this so it DOES NOT update the "update_on" column and only the "views" column? thanks eli
Steven Talcott Smith
2006-May-29 20:32 UTC
[Rails] Re: override automatic update of updated_on column
elisfanclub wrote:> the problem is that when a user visits the page, it AUTOMATICALLY > updates the "update_on" column with the current time. i don''t want this > to happen. how can i rewrite this so it DOES NOT update the "update_on" > column and only the "views" column?You could explicitly update the updated_on field with itself (old value). This will override the timestamp behavior. I have done this before in MySQL. YMMV. The resulting SQL should come out with "updated_on = updated_on" or "updated_on = ''<old value>''" Steven -- Posted via http://www.ruby-forum.com/.