Created
October 6, 2011 11:29
-
-
Save sevos/1267189 to your computer and use it in GitHub Desktop.
Class-Oriented example
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 Department < ActiveRecord::Base | |
has_one :stock | |
end | |
class Stock < ActiveRecord::Base | |
belongs_to :department | |
def update | |
update_attribute :value, Legacy::Department.find(department.id).stock_value | |
end | |
end | |
class Legacy::Department < ActiveResource::Base | |
# stuff here | |
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
class StocksController | |
def update | |
Stock.where(:department_id => params[:department_id]).first.udpate | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment