So I’m hacking on rails and in activerecord there are two methods that
have public and private versions. I need to override the private
method. How would I go about doing that?
Chris
So I’m hacking on rails and in activerecord there are two methods that
have public and private versions. I need to override the private
method. How would I go about doing that?
Chris
On Oct 26, 2007, at 12:09 PM, snacktime wrote:
So I’m hacking on rails and in activerecord there are two methods that
have public and private versions. I need to override the private
method. How would I go about doing that?Chris
If I understand what you are trying to do, this is typically how I do
that:
class Private
def run_func
you_cant_change_me
end
private
def you_cant_change_me
puts “you can’t change me!”
end
end
class Private
private
def you_cant_change_me
puts “you changed me!”
end
end
a = Private.new
a.run_func
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