Created
October 15, 2010 10:25
-
-
Save bogdan/627969 to your computer and use it in GitHub Desktop.
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 characters
class CompanyObserver < ActiveRecord::Observer | |
observe Company | |
def after_create(company) | |
unless company.current_issue | |
Issue.create!( | |
:title => "Создана компания #{company.title}", | |
:source => company | |
) | |
end | |
end | |
def after_update(company) | |
unless company.blocked? | |
Issue.create!( | |
:title => "Изменена компания #{company.title}", | |
:source => company | |
) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment