views:

33

answers:

2

Here is my route:

map.skip_contact_postalcard 'contacts/:contact_id/postalcards/:postalcard_id/skip', 
                      :controller => 'contact_postalcards', :action => 'skip' 

Here is my controller for ContactPostalcardsController:

  def skip

    @contact_postalcard = ContactPostalcard.new(params[:contact_postalcard])
    @contact_postalcard.contact_id = params[:contact_id]
    @contact_postalcard.postalcard_id = params[:postalcard_id]

    @contact_postalcard.status = "skipped"
    @contact_postalcard.date_sent = Date.today
    @contact_postalcard.date_created = Date.today

    if @contact_postalcard.save
      render :text => 'This email was skipped!'

    end
  end 

The way I invoke it is through remote_link in Rails, but even if I access it directly, I still get the problem.

A: 

Looks like you are missing a slash. Try this:

map.skip_contact_postalcard '/contacts/:contact_id/postalcards/:postalcard_id/skip', 
                  :controller => 'contact_postalcards', :action => 'skip'

Also, run 'rake routes' at the command line to make sure your route is indeed registered correctly.

sosborn
A: 

I thing the 500 error reasons remote_link method , I read you code and you request post . you tring to add fllow code to you controller:

protect_from_forgery :except => :skip
kenny