Trying to set up an observer to act on all tables. Found this post but
it doesn't work in Rails 3 (as usual) because :sublcasses is
deprecated:

class AuditObserver < ActiveRecord::Observer

  observe ActiveRecord::Base.send(:subclasses)

  def after_save(record)
    AuditTrail.new(record, "UPDATED")
  end
end

Tried replacing :subclasses with :decendants but it returns the
classes not the tables, and it includes all the fields:

[Person(id: integer, name: text, created_at: datetime, created_by:
text, updated_at: datetime, updated_by: text, email: string),
Member(person_id: integer, club_id: integer, role: text, created_at:
datetime, created_by: text, updated_at: datetime, updated_by: text,
id: integer), Club(id: integer, name: text, created_at: datetime,
created_by: text, updated_at: datetime, updated_by: text), Meeting(id:
integer, club_id: integer, meeting_date: date, meeting_time: time,
topic: text, created_at: datetime, created_by: text, updated_at:
datetime, updated_by: text)]

I need it to return a list like [:person,:member,:club,:meeting]

Any ideas?

Thanks, Lee

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to