module Refinery::PageOptions

Public Class Methods

attach!() click to toggle source
# File lib/refinery/page_options.rb, line 17
def attach!
  require 'refinery/page'
  require 'refinery/page_options/extension'

  config.enabled_models.each do |model_class_name|
    unless (model_class = model_class_name.safe_constantize)
      Rails.logger.warn "PageOptions is unable to find model class: #{model_class_name}"
      next
    end
    model_class.send :has_many_page_options
  end
end
factory_paths() click to toggle source
# File lib/refinery/page_options.rb, line 13
def factory_paths
  @factory_paths ||= [ root.join('spec', 'factories').to_s ]
end
root() click to toggle source
# File lib/refinery/page_options.rb, line 9
def root
  @root ||= Pathname.new(File.expand_path('../../../', __FILE__))
end

Public Instance Methods

enabled_models() click to toggle source
# File lib/refinery/page_options/configuration.rb, line 16
def enabled_models
  extract_enabled_option(:model)
end
enabled_tabs() click to toggle source
# File lib/refinery/page_options/configuration.rb, line 12
def enabled_tabs
  extract_enabled_option(:tab)
end
extract_enabled_option(key) click to toggle source
# File lib/refinery/page_options/configuration.rb, line 21
def extract_enabled_option(key)
  enable_for.map { |enable_for| enable_for[key] }.compact
end