Skip to content

Commit

Permalink
Namespacing: fixing the AR rebservers
Browse files Browse the repository at this point in the history
  • Loading branch information
Zlatko Zahariev committed Apr 10, 2013
1 parent 8b74d6d commit 34d3176
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/models/observers/fat_free_crm/entity_observer.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class FatFreeCrm::EntityObserver < ActiveRecord::Observer
observe :account, :contact, :lead, :opportunity
observe FatFreeCrm::Account, FatFreeCrm::Contact, FatFreeCrm::Lead, FatFreeCrm::Opportunity

def after_create(item)
send_notification_to_assignee(item) if current_user != item.assignee
Expand Down
2 changes: 1 addition & 1 deletion app/models/observers/fat_free_crm/lead_observer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#------------------------------------------------------------------------------

class FatFreeCrm::LeadObserver < ActiveRecord::Observer
observe :lead
observe FatFreeCrm::Lead

@@leads = {}

Expand Down
2 changes: 1 addition & 1 deletion app/models/observers/fat_free_crm/opportunity_observer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#------------------------------------------------------------------------------

class FatFreeCrm::OpportunityObserver < ActiveRecord::Observer
observe :opportunity
observe FatFreeCrm::Opportunity

@@opportunities = {}

Expand Down
2 changes: 1 addition & 1 deletion app/models/observers/fat_free_crm/task_observer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#------------------------------------------------------------------------------

class FatFreeCrm::TaskObserver < ActiveRecord::Observer
observe :task
observe FatFreeCrm::Task

@@tasks = {}

Expand Down
6 changes: 3 additions & 3 deletions lib/fat_free_crm/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class Engine < ::Rails::Engine
config.autoload_paths += Dir[root.join("app/models/**")] +
Dir[root.join("app/controllers/entities")]

#config.to_prepare do
# ActiveRecord::Base.observers = :lead_observer#, :opportunity_observer, :task_observer
#end
config.to_prepare do
ActiveRecord::Base.observers = FatFreeCrm::LeadObserver, FatFreeCrm::OpportunityObserver, FatFreeCrm::TaskObserver
end
end
end
4 changes: 1 addition & 3 deletions lib/fat_free_crm/fields.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ def has_fields

module SingletonMethods
def field_groups
raise FatFreeCrm::FieldGroup.inspect

if ActiveRecord::Base.connection.table_exists? 'field_groups'
FieldGroup.where(:klass_name => self.name).order(:position)
FatFreeCrm::FieldGroup.where(:klass_name => self.name).order(:position)
else
[]
end
Expand Down

0 comments on commit 34d3176

Please sign in to comment.