Skip to content

Instantly share code, notes, and snippets.

@munen
Created May 3, 2011 23:30
Show Gist options
  • Save munen/954460 to your computer and use it in GitHub Desktop.
Save munen/954460 to your computer and use it in GitHub Desktop.
Example of a RESTful interface for sopro2
class TourHistory < ActiveRecord::Base
belongs_to :location
end
class LocationHistory < ActiveRecord::Base
has_many :tours
belongs_to :user
end
class User < ActiveRecord::Base
end
# Needs an already created User (also via REST POST) with an ID of 123
post :create, :location_history => {:shortname=>"Neuschwanstein",
:user_id => 123,
:tours_history_attributes => [{ :name => "Kindertrour"},
{ :name => "Rentnertour"}]})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment