Assigning '0.0' to a nullable numeric column does not make it dirty
Example:
product = Product.create price: 0.0
product.price = '0.0'
product.changed? # => false (this used to return true)
product.changes # => {} (this used to return { price: [0.0, 0.0] })
When the Rails 4 gem is installed rdoc sees markdown files below the
guides directory and processes them. With an empty .document file
we prevent that from happening. Thanks to @drbrain for the tip.
Closes#9459.
The PR #6597 unified the configuration for `include_root_in_json`
in AM and AR to `false`.
Later on with the refactoring commit: e030f26 the value in AR was
set to `true` but I think this was not on purpose.
With this commit both AM and AR will have the same configuration
for `include_root_in_json`, which is `false`.
Fix ActionDispatch::Request#formats on xhr requests when HTTP_ACCEPT
header is empty string. About issue #7774, same fix as in commit bebb02f
but for xhr requests.
Rather than trying to use gsub to remove the optional route segments,
which will fail with nested optional segments, use a custom visitor
class that returns a empty string for group nodes.
Closes#9524
The current ActionController guide does not mention strong parameters
at all. I integrated the README into the guide to explain the API.
I also included a section to illustrate that the API does not solve
all possible whitelisting scenarios.
The origin was #9454.
Closes#7364.
Collection associations behave similar to Arrays. However there is no
way to prepend records. And to append one should use `<<`. Before this
patch `#append` and `#prepend` did not add the record to the loaded
association.
`#append` now behaves like `<<` and `#prepend` is not defined.
In an AR model a timestamptz attribute would return a ruby string and AR
tests did not check for any type casting. Previous tests would pass
only because an assert_equal was being used on a Time.utc object, which
will parse the right side of the eq to a valid Time instance for
comparision.
switch to test instance of Time instead of ActiveSupport::TimeWithZone
Support creating a table migration generator
Sometimes you want to create a table without an associated model and
test, which is also not a join table. With this commit, you can now
do that.
Example:
rails g migration create_posts title:string
or
rails g migration CreatePosts title:string
This commit also moves the template the model generator uses for the
migration to the migration templates folder, as it seems a more
sensible place for it now that it is shared code.
Sometimes you want to create a table without an associated model and
test, which is also not a join table. With this commit, you can now
do that.
Example:
rails g migration create_posts title:string
or
rails g migration CreatePosts title:string
This commit also moves the template the model generator uses for the
migration to the migration templates folder, as it seems a more
sensible place for it now that it is shared code.
Removed the bit about `SCRIPT_NAME` handling, since setting
`default_url_options[:script_name]` does work correctly.
We ran into an issue with it but it was an app bug.