Sha256: 609ee260a60085a0d58a66080265a75fb0d02ca16c5b1825d093be22523aaa81

Contents?: true

Size: 594 Bytes

Versions: 8

Compression:

Stored size: 594 Bytes

Contents

module Rows::Model

  def model_class
    @_model_class  ||= self.class.model_class ||
		       params[:controller].singularize.camelize.constantize
  end

 if Rails::VERSION::MAJOR > 3
  def model_name
    @_model_name   ||= model_class.model_name.name
  end

  def model_symbol
    @_model_symbol ||= model_class.model_name.singular
  end
 else
  def model_name
    @_model_name ||= model_class.name
  end

  def model_symbol
    @_model_symbol ||= model_name.underscore.gsub( %r{/}, '_' )
  end
 end

  def model_symbol_plural
    @_model_symbol_plural ||= model_symbol.pluralize
  end

end

Version data entries

8 entries across 7 versions & 1 rubygems

Version Path
rows_controller-2.2.1 lib/rows/model.rb
rows_controller-2.2.0 lib/rows/model.rb
rows_controller-2.2.0 lib/rows/model.rb.bak
rows_controller-2.1.3 lib/rows/model.rb
rows_controller-2.1.2 lib/rows/model.rb
rows_controller-2.1.0 lib/rows/model.rb
rows_controller-2.0.8 lib/rows/model.rb
rows_controller-2.0.7 lib/rows/model.rb