1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00

Added support for tableless ActiveRecord models

This commit is contained in:
Mike Dvorkin 2010-04-03 21:42:31 -07:00
parent 7e35764f3d
commit c6acd66ee8
2 changed files with 1 additions and 5 deletions

View file

@ -38,7 +38,7 @@ module AwesomePrintRails
# Format ActiveRecord class object.
#------------------------------------------------------------------------------
def awesome_active_record_class(object)
if object.table_exists?
if object.respond_to?(:columns)
data = object.columns.inject(ActiveSupport::OrderedHash.new) do |hash, c|
hash[c.name.to_sym] = c.type
hash

View file

@ -13,10 +13,6 @@ if defined?(::Rails)
columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null)
end
def self.table_exists?
true
end
column :id, :integer
column :name, :string
column :rank, :integer