开发者

Updating database record through link in email for Rails 3

My app sends out reminder emails and in each of these emails I'd like to include a link for the user to click th开发者_StackOverflowat would update a record in the database.

I don't think I want this tied in through a controller, as that would then push this 'request' from the email link to a view of some sort in the browser.

Is there any way to accomplish this without a controller handling the 'request'?

Any help is greatly appreciated.


If I understand correctly you want the user to follow a link that leads to a view and updates one or more attributes in the database.

Rails is built around the Model-View-Controller principle. A request is taken from the Rails router and handed over to the corresponding controller and action. The controller does the job, invokes the model (that queries the database) and then hands over to the view. A view is for displaying data, not for working with data and never updates anything in the model!

In your case: your link should lead to a controller/action where you do the update of your record and then display a view.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜