Created
June 21, 2012 03:15
-
-
Save tomciopp/2963596 to your computer and use it in GitHub Desktop.
Revisions
-
There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ belongs_to :reservation belongs_to :user attr_accessible :reservation_id, :user_id This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ has_many :appointments has_many :users, :through => :appointments This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ def create # When I create a reservation I should have two users added to the appointments table # the creator of a task, and the person whose bid the creator accepted. @reservation = @task.build_reservation(...) @creator = @task.user @bidder = @reservation.bid.user if @reservation.save #should I just rewrite the save method as something else like save_and_make_appointments, and offload this to the model. redirect_to @task else flash[:notice] = "you have broken something" redirect_to root_path end end This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ has_many :appointments has_many :reservations, :through => :appointments