开发者

How Modify route standard Rails3?

开发者 https://www.devze.com 2023-02-20 18:23 出处:网络
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 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

精彩评论

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