Skip to content

Instantly share code, notes, and snippets.

@alexeckermann
Created March 1, 2012 00:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexeckermann/1945951 to your computer and use it in GitHub Desktop.
Save alexeckermann/1945951 to your computer and use it in GitHub Desktop.
How can this be done without calling a private method?
# app/models/registration.rb
class Registration
attr_accessor :current_step
end
# Registration then ONLY has :current_step in it and the other methods from the engine are blasted
# config/initializers/extensions.rb
# ---
# Registration is defined as a model in an engine.
# On the local app I want to add :current_step as an attr so I can use it in the interface.
# Without adding it to the engine model how can I extend the class without resorting to calling include like this.
# Ideally id love to put this into app/models/registration.rb but "X file expects to define class Y" is a bitch.
module Extension
module Registration
attr_accessor :current_step
end
end
Registration.send(:include, Extension::Registration)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment