Displaying 5 results from an estimated 5 matches for "class_of_active_record_descend".
2008 Feb 21
1
polymorphic has_many from ActiveRecord::Base????
I have a polymorphic thingy called fields and I need to on each and
every model, so I''d like to do the has_many from the base class, like
this...
ActiveRecord::Base.class_eval do
has_many :fields, :as => :model, :dependent => true
end
It fails with this no method error (class_of_active_record_descendant)
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.6/lib/active_record/
base.rb:1369:in `class_of_active_record_descendant'':NoMethodError:
undefined method `abstract_class?'' for Object:Class
Is there a better way to do this???
--~--~---------~--~----~------------~-------~--~---...
2008 Jan 08
1
add comments to ALL models (ie automatically add has_many)
...utomaically add these to EVERY
model ?
I tried the following but it fails with an error...
ActiveRecord::Base.class_eval do
has_many :notes, :as => :model_with_notes, :dependent => true
end
fails with....
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.6/lib/active_record/
base.rb:1369:in `class_of_active_record_descendant'':NoMethodError:
undefined method `abstract_class?'' for Object:Class
--~--~---------~--~----~------------~-------~--~----~
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 rubyon...
2012 Jul 25
0
Rails3-default_scope throws exception: undefined method abstract_class? for Object:Class
...lizer/active_record_patch.rb:
class ActiveRecord::Base
def inactive
update_attribute(:available, false)
end
default_scope :available => true
end
Getting following error when add the default_scope
*/gems/ruby-1.9.2-p290/gems/activerecord-3.0.9/lib/active_record/base.rb:1212:in
class_of_active_record_descendant'': undefined methodabstract_class?'' for
Object:Class (NoMethodError)*
--
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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@pu...
2006 Jul 05
2
Serialized object behaves weird
Hi!
I got a class named EinsatzFilter which I serialized to session. Before
saving to session it works afterwards I keep getting the message:
"undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from
ActiveRecord::Base inherited class.
Code:
class EinsatzFilter
include ApplicationHelper
attr_reader :personen, :monat, :projekte, :kunde
2007 Nov 15
4
Using .find_by_sql for database/admin queries
I want to create an internal admin view to display the output of "show
variables" from mysql. What''s the best approach do this?
For example, I''m doing something like this:
@variables = ActiveRecord::Base.find_by_sql "show variables;"
Then, I get stuff like this back (227 elements in @variables) in
script/console:
>> @variables[0]
=>