Sha256: 60d25d97444a4a9fe905750e8736e4fd23a662eb395f8254745eedf8e9f6fb1c

Contents?: true

Size: 665 Bytes

Versions: 1

Compression:

Stored size: 665 Bytes

Contents

require 'ourkudos'
module OurKudos
  module Api
    module Controllers
      module ApiHelper

        def current_model
          @current_model ||= Kernel.const_get controller_name.singularize.classify
        end

        def api_columns *skipped
          current_model.column_names.select do |c|
            !c.include?("_id") && !c.include?("_by") &&
              !c.include?("_at") && !skipped.include?(c)
         end
        end

        def model_as_symbol
          controller_name.singularize.to_sym
        end

        def model_instance
          instance_variable_get "@#{controller_name.singularize}"
        end

        end
      end
   end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ourkudos-0.0.38 lib/ourkudos/controllers/api_helper.rb