lib/chosen_template.rb in chosen_template-0.0.1 vs lib/chosen_template.rb in chosen_template-0.1.0

- old
+ new

@@ -2,34 +2,12 @@ require 'active_support/core_ext/class' require 'active_support/inflector' require "chosen_template/version" require 'chosen_template/chooser' require 'chosen_template/chosen' +require 'chosen_template/choosable_template_controller' -module ChosenTemplate - CHOOSABLE_REQUIRED_COLUMNS = [:template_published_at, :template_previewed_at] +require 'chosen_template/active_record_extensions' +require 'chosen_template/action_controller_extensions' - extend ActiveSupport::Concern - - module ClassMethods - def chooses_templates(*template_choices) - cattr_accessor :template_choices - self.template_choices = template_choices - include Chooser - end - - def choosable_template(options={}) - cattr_accessor :chosen_by - self.chosen_by = options[:by] - - CHOOSABLE_REQUIRED_COLUMNS.each do |column_name| - unless self.column_names.include?(column_name.to_s) - raise ArgumentError, "`#{self.table_name}` requires the `#{column_name}` column" - end - end - include Chosen - end - end - +module ChosenTemplate end - -ActiveRecord::Base.send :include, ChosenTemplate