ruby on rails 3 - How to update datatime attribute? -
i want update last_clicked_on:datetime attribute current time.
class feedentriescontroller < applicationcontroller def show @feed_article = feedentry.find(params[:id]) @feed_article.update_attributes(is_to_read: 'false') @feed_article.update_attributes(last_clicked_on: time.now) @way = @feed_article.url redirect_to @way end end
but above code not working. please me resolve issue.
i guess can try
@feed_article.is_to_read = 'false' @feed_article.last_clicked_on = time.now @feed_article.save!
anyway it's hard info. issue might in type of columns, can misspell name of column... else...
ps
each update_attributes
issue transaction in db, so, have 2 transactions instead of one... code above have 1 transaction
Comments
Post a Comment