Beta Invitation in Rails 3, little problem

INVITATION BETA EMAIL

I have in the email that the app send to friend's email address

the problem is here

def create @invitation = Invitation.new(params[:invitation]) respond_to do |format| if @invitation.save Mailer.invitation(@invitation, signup_url(:invitation_token=>@invitation.token)).deliver

   format.html { redirect_to(@invitation, :notice => 'Invitation

was successfully created.') } format.xml { render :xml => @invitation, :status => :created, :location => @invitation }

 redirect_to root_url
 else
   format.html { render :action => "new" }
   format.xml  { render :xml => @invitation.errors, :status =>

:unprocessable_entity } end end

end

try it now

Radhames Brito wrote in post #987907:

   @invitation = Invitation.new(params[:invitation])

   respond_to do |format|      if @invitation.save      Mailer.invitation(@invitation, signup_url(*:invitation_token=>*@invitation.token)).deliver        format.html { redirect_to(@invitation, :notice => 'Invitation was successfully created.') }        format.xml { render :xml => @invitation, :status => :created, :location => @invitation }      redirect_to root_url      else        format.html { render :action => "new" }        format.xml { render :xml => @invitation.errors, :status => :unprocessable_entity }      end    end end

I simply substitute the follow line

Mailer.invitation(@invitation,signup_url(@invitation.token)).deliver

with this

Mailer.invitation(@invitation,signup_url(@invitation.token)).deliver

this is the result http://localhost:3000/signup?invitation_token=30220e3a8db1994bc7c672d55491991f8e2ebf1a

I wish this

http://localhost:3000/signup/30220e3a8db1994bc7c672d55491991f8e2ebf1a

I'm searching in other forum and documentation on line ... when I will find the solution will put there ...

bye,

C ps. I don't understand 'cause you put the '*' simbol

I simply substitute the follow line

Mailer.invitation(@invitation,signup_url(@invitation.token)).deliver

with this

Mailer.invitation(@invitation,signup_url(@invitation.token)).deliver

try this , go to the console and type rails c, then type this

r = ActionController::Routing::Routes

then

r.generate :controller => :invitations, :action => create , : invitation_token => “123”

see if it generates what you want , then use

Mailer.invitation(@invitation,url_for (:controller => :invitations, :action => create , : invitation_token => @invitation.token,:method => :post)).deliver

Radhames Brito wrote in post #988052:

try this , go to the console and type rails c, then type this

r = ActionController::Routing::Routes

then

r.generate :controller => :invitations, :action => create , : invitation_token => "123"

see if it generates what you want , then use

Mailer.invitation(@invitation,url_for (:controller => :invitations, :action => create , : invitation_token => @invitation.token,:method => :post)).deliver

Hey thank you ... for your answer the environment of rails c is Rails 3.0.1 and use your advices I receive only an error message after I insert your follow command:

r.generate :controller => :invitations, :action => create , : invitation_token => "123"

NameError: undefined local variable or method ´create' for main:Object from (irb): 2

Anyway I will use your previous suggest It's works to accept the invitation sign up but the signup url is like this:

http://localhost:3000/signup?invitation_token=3022

thank you,

C

it appears that you are launching irb not rails console, to go to the rails console you have to type

rails c

at the app directory, then try mixing

r.generate :controller => :invitations, :action => create , :invitation_token => “123”

until you get what you want.

Radhames Brito wrote in post #988228:

rails c

at the app directory, then try mixing

r.generate :controller => :invitations, :action => create , :invitation_token => "123"

until you get what you want.

I tried same error

NameError: undefined local variable or method create' for main:Object from (irb): 2

I believed that the command "rails console" is the same "rails c" isn`t it?

Yes it is. but i thought you may have mistakenly used irb instead of rails c