Sha256: adadba18822dbfe4f25a3234d7197f0a59e60109059a72584f1fada110c43c10
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
module Puffer module Controller module Mutate extend ActiveSupport::Concern included do layout 'puffer' helper :puffer delegate :model, :model_name, :to => 'self.class' helper_method :namespace, :resource, :record, :records end module InstanceMethods def namespace params[:namespace] || self.class.namespace end def resource @resource ||= Puffer::Resource.new params, self end def record @record || instance_variable_get("@#{resource.model_name}") end def records @records || instance_variable_get("@#{resource.model_name.pluralize}") end end module ClassMethods def puffer? true end def namespace to_s.underscore.split('/').first end def model_name @model_name ||= (configuration.model_name || controller_name.singularize).to_s end def model @model ||= model_name.camelize.constantize rescue nil end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
puffer-0.0.29 | lib/puffer/controller/mutate.rb |