Sha256: 8f3e6af943871eb07765c6c302e935a5ad0c5ddea96481db3337bbaf98972e14

Contents?: true

Size: 425 Bytes

Versions: 6

Compression:

Stored size: 425 Bytes

Contents

# encoding: utf-8

module Fastui
  class MModel

    def initialize(model)
      @model = model
    end

    def name
      @model.to_s
    end

    def columns
      @model.columns
    end

    def self.all
       @@models ||= ::ActiveRecord::Base.subclasses.map {|ar| MModel.new(ar)}
    end

    def self.find(class_name)
      all.detect {|m| m.class.to_s == class_name.to_s }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fastui-0.1.8 lib/fastui/m_model.rb
fastui-0.1.7 lib/fastui/m_model.rb
fastui-0.1.6 lib/fastui/m_model.rb
fastui-0.1.4 lib/fastui/m_model.rb
fastui-0.1.3 lib/fastui/m_model.rb
fastui-0.1.2 lib/fastui/m_model.rb