Created
May 3, 2011 23:30
-
-
Save munen/954460 to your computer and use it in GitHub Desktop.
Example of a RESTful interface for sopro2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TourHistory < ActiveRecord::Base | |
belongs_to :location | |
end | |
class LocationHistory < ActiveRecord::Base | |
has_many :tours | |
belongs_to :user | |
end | |
class User < ActiveRecord::Base | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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