Rails (newbie) - How to store a token variable in a link in db on create action -
i have problem create action , don't understand why wrong here.
users can follow link contain token variable. here route.
routes.rb
match "/:token" => "invitations#new", :via => :get
on create action want token stored in sender_token instance in db.
i tried this:
invitation controller
def new @invitation = invitation.new end def create @invitation = invitation.new(params[:invitation]) if @invitation.save # here pb ??? @invitation.sender_token = :token session[:invitation] = @invitation mailer.invitation(@invitation).deliver redirect_to invite_request_path else render :action => 'new' end end
thank you!
shouldn't be
@invitation.sender_token = params[:token]
Comments
Post a Comment