I''m using Rails 2.3.5 and finding that for lines like these below in a
model,
the block is never executed. Am I doing something wrong or was this
introduced in a later version of Rails?
before_create :preprocess_score
def preprocess_score
puts "HERE: #{__LINE__}"
self[''score''] = Token.process(token_counts, feed.user_id)
end
OR:
before_create do |a|
puts "HERE"
a.write_attribute(''score'', Token.process(token_counts,
a.feed.user_id))
end
TIA,
Jeffrey
--
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@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Never mind, bitten by fixtures. They aren''t created normally and the callbacks aren''t called. Jeffrey Quoting Jeffrey L. Taylor <ror-f/t7CGFWhwGcvWdFBKKxig@public.gmane.org>:> I''m using Rails 2.3.5 and finding that for lines like these below in a model, > the block is never executed. Am I doing something wrong or was this > introduced in a later version of Rails? > > before_create :preprocess_score > > def preprocess_score > puts "HERE: #{__LINE__}" > self[''score''] = Token.process(token_counts, feed.user_id) > end >-- 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@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.