Skip to content

Instantly share code, notes, and snippets.

@strikyflo
Created March 19, 2015 06:04
Show Gist options
  • Save strikyflo/6c531a3803eda2367d03 to your computer and use it in GitHub Desktop.
Save strikyflo/6c531a3803eda2367d03 to your computer and use it in GitHub Desktop.
class Page < ActiveRecord::Model
scope :by_permalink, -> { |permalink| where(:permalink => permalink) }
def content_data
Oj.load(content)
end
def self.find_by_permalink(permalink)
by_permalink(permalink).first
end
end
class PagesController < ApplicationController
def show_static
# code to retrieve the correct subdomain
@page = Page.find_by_permalink(subdomains.first)
@feature = Feature.new(@page.user)
@data = @page.data_content # usually we change some of the content but it's been deactivated
render :show, :layout => 'show', :formats => [:html]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment