I’m trying to make the create method private/protected for an ActiveRecord model. I want to do something like this:
class Product < ActiveRecord::Base
def self.create(options)
private
super(options)
end
end
so that I am unable to do Product.create(...). However, I need to do this
class Pencil < Product
def self.create(options)
options["category"] = "stationary"
super(options)
end
end
so that I can do this Pencil.create(...). Thanks in advance!
1 Answer