0

i m using engine ... i want to override a user model from engine to my app...

please tell me how to do

Model in my local app looks like below

 require_dependency EngineName::Engine.root.join('app','models','Model name').to_s
  module EngineName
   class Model < EngineName::ModelName

    def method name
      SUPER
    end
  end
end

i am getting error like superclass mismatch for class ModelName,

please give me some sugestion

  • look at the official tutotial [Overriding Models and Controllers](http://edgeguides.rubyonrails.org/engines.html#overriding-models-and-controllers) all the suggestions and exmples are there : For simple class modifications use `Class#class_eval`, and for complex class modifications, consider using `ActiveSupport::Concern`. – user2323194 Apr 26 '13 at 10:08
  • thanks its help me lots but i m unable to use super method from my local app – Swagata Mondal Apr 26 '13 at 10:28
  • EngineName::Engine.root.join('app','models','Model name') why ModelName? Is it your typing error?paste your real code so that i can have a look.and make it ModelName – user2323194 Apr 26 '13 at 10:33
  • require_dependency Cb::Engine.root.join('app','models','cb','user').to_s – Swagata Mondal Apr 26 '13 at 10:47
  • def api_create_user super.api_create_user end – Swagata Mondal Apr 26 '13 at 10:50

0 Answers0