I’m trying to override the behavior of find_with_associations for an
acts_as
plugin.
Not having much luck as it’s a private method, so I can’t alias it, and
my
method
of the same name is ignored.
Is this even possible?
joshua
I’m trying to override the behavior of find_with_associations for an
acts_as
plugin.
Not having much luck as it’s a private method, so I can’t alias it, and
my
method
of the same name is ignored.
Is this even possible?
joshua
In the ruby example below, it looks like you can override a private
function. Can you post code?
-Peter
class A
private
def foo
“foo”
end
end
class A
private
def foo
“foofoo”
end
public
def bar
foo
end
end
a = A.new
puts a.bar # outputs “foofoo”
In the process of grabbing my code to post, I solved it!!!
I had to include the methods straight into ActiveRecord::Base not into
ActiveRecord::Associations
eg
ActiveRecord::Base.send :include,
Democracy::Acts::Multilingual::Associations
I was worried that it just wasn’t possible, because doing something as
simple as this doesn’t work
module ActiveRecord
module Associations
private
def association_join(*args)
breakpoint
super
end
end
end
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs