Calling a literal ActiveRecord::Base.new raises NoMethodError,
since it ends up calling Class.abstract_class? which does not exist.
Similarly, instantiating an actual abstract class hits the database,
when conventionally it should immediately throw NotImplementedError.
ActiveRecord::Base can't be made abstract without breaking many,
many things, so check for it separately.
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.
Support PostgreSQL specific column types when using `change_table`.
We use `TableDefinition` for `#create_table` and `Table` for `#change_table`.
The PostgreSQL sepcific types were only defined on `TableDefinition` so they needed to be added to `Table` as well.
Closes#9480.
We use `TableDefinition` for `#create_table` and `Table` for `#change_table`.
The PostgreSQL sepcifc types were only defined on `TableDefinition` so I
also added them to `Table`.
Closes#9466.
Passing `format: true` used to override the constraints: { format: /json/ }
with `/.+/`. This patch only sets the format if there is no constraint present.
Fix calculation of db_runtime property in
ActiveRecord::Railties::ControllerRuntime#cleanup_view_runtime.
Previously, after raising ActionView::MissingTemplate, db_runtime was
not populated.
Closes#9218, Fixes#9215.
Conflicts:
activerecord/CHANGELOG.md