diff options
author | Vipul A M <vipulnsward@gmail.com> | 2016-04-13 12:00:07 +0530 |
---|---|---|
committer | Vipul A M <vipulnsward@gmail.com> | 2016-04-13 12:00:07 +0530 |
commit | 68ece40a383863c4bc63a4bc13a207ac016ab8c5 (patch) | |
tree | 3f35acb70ce2d72ca45a88a0bf8b2f0ae062dffb /activerecord/lib/active_record | |
parent | fe9bd013e2806066e0e43b8b0b4dabab0c8549d1 (diff) | |
download | rails-68ece40a383863c4bc63a4bc13a207ac016ab8c5.tar.gz rails-68ece40a383863c4bc63a4bc13a207ac016ab8c5.tar.bz2 rails-68ece40a383863c4bc63a4bc13a207ac016ab8c5.zip |
- Be consistent in providing file locations of schema, model and initializer
[ci skip]
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/attributes.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/attributes.rb b/activerecord/lib/active_record/attributes.rb index e0ceafc617..519de271c3 100644 --- a/activerecord/lib/active_record/attributes.rb +++ b/activerecord/lib/active_record/attributes.rb @@ -67,12 +67,14 @@ module ActiveRecord # # A default can also be provided. # + # # db/schema.rb # create_table :store_listings, force: true do |t| # t.string :my_string, default: "original default" # end # # StoreListing.new.my_string # => "original default" # + # # app/models/store_listing.rb # class StoreListing < ActiveRecord::Base # attribute :my_string, :string, default: "new default" # end @@ -89,6 +91,7 @@ module ActiveRecord # # \Attributes do not need to be backed by a database column. # + # # app/models/my_model.rb # class MyModel < ActiveRecord::Base # attribute :my_string, :string # attribute :my_int_array, :integer, array: true @@ -131,7 +134,7 @@ module ActiveRecord # # config/initializers/types.rb # ActiveRecord::Type.register(:money, MoneyType) # - # # /app/models/store_listing.rb + # # app/models/store_listing.rb # class StoreListing < ActiveRecord::Base # attribute :price_in_cents, :money # end @@ -167,8 +170,10 @@ module ActiveRecord # end # end # + # # config/initializers/types.rb # ActiveRecord::Type.register(:money, MoneyType) # + # # app/models/product.rb # class Product < ActiveRecord::Base # currency_converter = ConversionRatesFromTheInternet.new # attribute :price_in_bitcoins, :money, currency_converter: currency_converter |