i have a rails application from the that have a list of members, so what i want is that when ever i open a member i want to have a link so that when they click on it ,it will save the c开发者_C百科urrent date and time with the membership number.
I think you are referring to modifying the updated_at field for that record in the DB. I assume you followed proper practices here and you do have an updated_at column.
You can use the button_to helper to call you update action in the users_controller. In the controller you have, do the following:
def update
@user = User.find(params[:id])
@user.touch
# render/redirect as you wish
end
Touch will set the updated_at time to the current time, alternatively you can also use model.touch(:column_name) if you have a timestamp column with a different name then updated at.
加载中,请稍侯......
精彩评论