开发者

How Modify route standard Rails3?

I am using Rails3 and I would like make one request for get one parameter token to my controller different of ID to my action "confirms "in my controller,can someone help me? I be开发者_如何学运维lieve is a problem in my route.

such as:

http://0.0.0.0:3000/emails/1QWD3DF2Cd/confirms or http://0.0.0.0:3000/emails/confirms/1QWD3DF2Cd

`
class EmailsController < ApplicationController  
      def confirms
        @email = Email.find(params[:token])
        @email.confirmed # other method in model emails which mark as enable  
     end
end 

`


You can do this

Add this to your routing.rb file.

match '/emails/confirms/:token' => 'emails#confirms', :as => 'confirms_emails'
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜