Last active
August 29, 2015 14:19
-
-
Save jurgens/0868b5b463f3d940cb76 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
class NewsController < ApplicationController | |
meta_data :news, [:index] | |
def index | |
puts "page = #{@page}" | |
render text: @page | |
end | |
end |
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
class ApplicationController | |
def self.meta_data(page, actions) | |
before_filter "load_meta_page_#{page}".to_s, only: actions | |
end | |
def method_missing(method, *arguments) | |
puts "method missing #{method}, #{arguments}" | |
if match_data = /^load_meta_page_(.+)$/.match(method) | |
load_meta_page match_data[1] | |
end | |
end | |
def load_meta_page(slug) | |
#load page by slug | |
@page = "#{slug} page" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment