'self.abstract_class = true' does not seem to be working in my Rails 3
project and I am having difficulty debugging the problem. Can anyone
give
me some pointers as to were I should look for possible conflicts?

In a previous Rails 2 project I used an abstract class SoftDeletableBase
to add soft delete options to my models.

I am now working on a Rails 3 project, and now need to add similar
functionality. I've reworked SoftDeletableBase to work with Rails 3
(refactored scope options), but when I go to implement it the system
seems to be ignoring the abstract class declaration.

In trying to debug the problem, I commented out everything but the class
definition and the abstract class definition. Still the problem remains.

This is what I have:

class SoftDeletableBase < ActiveRecord::Base
  self.abstract_class = true
end

class User < SoftDeletableBase
end

At the console I get:

irb(main):006:0> User.table_name
=> "soft_deletable_bases"

That is, the table name for the User model is coming back as
"soft_deletable_bases" when it should be "users".

If I return the model class to 'User < ActiveRecord::Base' everything
returns to normal:

irb(main):024:0> User.table_name
=> "users"

I've googled 'rails 3 abstract_class' but cannot find anyone else with a
similar problem. Therefore, I'm assuming there is something in my
application that is stopping abstract_class from working properly. My
main problem is that I not sure where to look for the root of the
problem.

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to