Sha256: 70227c0bf50b85c12ccdc307fd348836b9d41151c980a266606db45901e9e8ee

Contents?: true

Size: 440 Bytes

Versions: 5

Compression:

Stored size: 440 Bytes

Contents

module FunkyForm
  module ClassMethods
    def model_name(model_name = nil)
      if model_name
        @model_name = model_name
      else
        @model_name ||= superclass.model_name
      end
    end

    private

    def model(klass = nil)
      if klass.respond_to?(:model_name)
        model_name klass.model_name
      elsif klass.is_a?(String)
        model_name ActiveModel::Name.new(self, nil, klass)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
funky_form-0.2.1 lib/funky_form/class_methods.rb
funky_form-0.2.0 lib/funky_form/class_methods.rb
funky_form-0.1.3 lib/funky_form/class_methods.rb
funky_form-0.1.2 lib/funky_form/class_methods.rb
funky_form-0.1.1 lib/funky_form/class_methods.rb