Sha256: 1ae528e784c6ef2e6c713460a04c1a228d0e23795cba20f003da44fb220db023

Contents?: true

Size: 607 Bytes

Versions: 7

Compression:

Stored size: 607 Bytes

Contents

module Puffer
  module Controller
    module Helpers

      def self.included base
        base.class_eval do
          include InstanceMethods

          helper_method :resource_session, :resource, :record, :records
        end
      end

      module InstanceMethods

        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

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
puffer-0.0.26 lib/puffer/controller/helpers.rb
puffer-0.0.25 lib/puffer/controller/helpers.rb
puffer-0.0.24 lib/puffer/controller/helpers.rb
puffer-0.0.23 lib/puffer/controller/helpers.rb
puffer-0.0.22 lib/puffer/controller/helpers.rb
puffer-0.0.21 lib/puffer/controller/helpers.rb
puffer-0.0.20 lib/puffer/controller/helpers.rb