diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2016-04-29 16:00:15 +0000 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2016-04-29 16:00:15 +0000 |
commit | 9d1bf059c0a570f68b2394bfb383434a6b0d0a49 (patch) | |
tree | 67b2ede3e22eda2eac05ccaf6fa0db4164662bbe /activerecord | |
parent | 4a446220a67e115c04a2b562dce92981a8e18c78 (diff) | |
parent | 0f91e2bc2591340369c7644678eab6c1d93043c1 (diff) | |
download | rails-9d1bf059c0a570f68b2394bfb383434a6b0d0a49.tar.gz rails-9d1bf059c0a570f68b2394bfb383434a6b0d0a49.tar.bz2 rails-9d1bf059c0a570f68b2394bfb383434a6b0d0a49.zip |
Merge branch 'master' of github.com:rails/docrails
Conflicts:
guides/source/configuring.md
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/attributes.rb | 7 | ||||
-rw-r--r-- | activerecord/lib/active_record/model_schema.rb | 2 |
2 files changed, 7 insertions, 2 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 diff --git a/activerecord/lib/active_record/model_schema.rb b/activerecord/lib/active_record/model_schema.rb index 52eab952e1..f691a8319d 100644 --- a/activerecord/lib/active_record/model_schema.rb +++ b/activerecord/lib/active_record/model_schema.rb @@ -238,7 +238,7 @@ module ActiveRecord end # Returns the next value that will be used as the primary key on - # an insert statment. + # an insert statement. def next_sequence_value connection.next_sequence_value(sequence_name) end |