Skip to content

Instantly share code, notes, and snippets.

@jonsgreen
Created April 8, 2011 15:42
Show Gist options
  • Save jonsgreen/910137 to your computer and use it in GitHub Desktop.
Save jonsgreen/910137 to your computer and use it in GitHub Desktop.
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