vlado/rails_db_info

View on GitHub
lib/rails_db_info/table.rb

Summary

Maintainability
A
0 mins
Test Coverage
module RailsDbInfo
  class Table

    attr_reader :name

    def initialize(table_name)
      @name = table_name
    end

    def columns
      connection.columns(name)
    end

    def column_properties
      %w(name sql_type null limit precision scale type default)
    end

    def to_param
      name
    end


    private

    def connection
      ActiveRecord::Base.connection
    end
  end
end