I have some common class methods in a module
''active_record_additions''
that I load into a class by Activity by using extend ActiveRecordAdditions
The Activity class uses nested_attributes_for with a reject_if method saved
in the module ''active_record_additions''
The problem is that the class methods in
''active_record_additions'' works
when I use them as ordinary class methods, but not as a a method in
reject_if.
I got the message NameError (undefined method
`exists_nested_targeting_group?'' for class `Activity''):
Maybe that method cannot be a class method ?
Or can accept_nested use methods in an extend module ?
Or anyone thats can give a hint abot whay it does not work ?
Some code snippets
The class definition
# encoding: utf-8
require ''active_record_additions''
######################################
class Activity < ActiveRecord::Base
include ActiveModel::Validations
extend ActiveRecordAdditions
The accept nested call
accepts_nested_attributes_for :targeting_group, :reject_if =>
:exists_nested_targeting_group?, :allow_destroy => true
The start of the exists_nested_targeting_group? module
def exists_nested_targeting_group?(attributes={})
exists=false
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/Pkgj4t4MyfAJ.
For more options, visit https://groups.google.com/groups/opt_out.