I created a Rails application normally. Then created the scaffold for an event class. Then tried the following code. When run it complains about a InvalidAuthenticityToken when the destroy method is executed. How do I authenticate to avoid this response?
require 'rubygems' require 'activeresource' class Event < ActiveResource::Base self.site = 'http://localhost:3000' end e = Event.create( :name => 'Shortest Event Ever!', :starts_at => 1.second.ago, :capacity => 25, :price => 10.00) e.destroy
I found an answer to this issue which works since I am writing a command-line application. I added the following to my controller: