Created
April 8, 2011 15:42
-
-
Save jonsgreen/910137 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MyApp | |
module Extensions | |
module Page | |
def self.included(base) | |
base.class_eval do | |
belongs_to :account | |
end | |
end | |
end | |
module PagesController | |
def self.included(base) | |
base.class_eval do | |
def find_all_pages | |
super | |
# this is what I think I want to do if I ever get there | |
@pages.where(:account_id => current_user.account_id) | |
end | |
end | |
end | |
end | |
end | |
end | |
# in application.rb: | |
config.before_initialize do | |
require 'refinery_page_extensions' | |
end | |
config.to_prepare do | |
Page.send :include, MyApp::Extensions::Page | |
Admin::PagesController.send :include, MyApp::Extensions::PagesController | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment