search for: read_methods

Displaying 3 results from an estimated 3 matches for "read_methods".

2006 Apr 10
0
Inheriting data from one model to another
...on.price it uses method_missing() and send() to decide which value to return. ProductVariation looks like this: class ProductVariation < Product belongs_to :parent_product, :class_name => "Product", :foreign_key => "parent_id" @@generate_read_methods = false # turn off generating read_methods otherwise method_missing won''t get called more than once # intercept calls to read attributes. If this instance has # a value return it, otherwise escalate the call to the parent_product def method_missing(method_id, *args, &block)...
2006 May 10
13
Issue in ActiveRecord generated reader methods
...an to see undefined behavior from rails. The first request to read an attribute would be denied correctly, however further requests would proceed without fail. After a lot of searching, I think I have traced the problem down to the generated read methods. When ActiveRecord::Base#generate_read_methods is false, all is well. When its true, my migraine returns. More research, reading, and I come to this curiosity... ActiveRecord::Base#define_read_method(symbol, attr_name, column) generates reader code for an attribute after Rails realizes there should be a reader method for it, correct?...
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