| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
Associations now raises `ArgumentError` on name conflicts. Closes #13217.
|
| |
| |
| |
| |
| | |
Dangerous association names conflicts include instance or class
methods already defined by `ActiveRecord::Base`.
|
|\ \
| |/
|/| |
Remove unused variable.
|
|/ |
|
|\
| |
| | |
Let `unscope` ignore non Arel scope.where_values
|
| | |
|
|\ \
| | |
| | | |
Fix regression on .select method
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This was a common pattern:
```
query = author.posts.select(:title)
connection.select_one(query)
```
However `.select` returns a ActiveRecord::AssociationRelation, which has
the bind information, so we can use that to get the right sql query.
Also fix select_rows on postgress and sqlite3 that were not using the binds
[fixes #7538]
[fixes #12017]
[related #13731]
[related #12056]
|
|\ \ \
| |_|/
|/| | |
Add CreateMigration action
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This Thor-action isolates the logic whether to (over-)write migration and
what is shown to the user. It's modelled after Thor's CreateFile-action.
This solves the issue that removing a non-existing migration, tried to
remove the template-path (#13588).
Related issues: #12674
|
| | | |
|
|\ \ \
| | | |
| | | | |
Replace Post model with Article model in getting started guide [ci skip]
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
- Used Article model instead of Post as it may confuse with 'post'
requests
- Tried to wrap the guide to 80 chars lines as much as possible.
- Removed unused image
- Fixes #13764
|
|\ \ \ \
| | | | |
| | | | | |
Add `travel_back` to remove stubs from `travel` and `travel_to` and remove auto-rollback after each test case
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This behavior is only work out-of-box with minitest and also add a
downside to run after each test case, even if we don't used the travel
or travel_to methods
|
|/ / / / |
|
|\ \ \ \
| | | | |
| | | | | |
find_in_batches should not mutate its argument
|
| | | | | |
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
There is no gain in `referencing` tables that are not used for preloading.
Furthermore it will break if polymorphic associations are invloved. This
is because `references_eager_loaded_tables?` uses all `reference_values`
to decide wether to `eager_load` or `preload`.
|
|\ \ \ \ \
| |_|_|_|/
|/| | | | |
Modify the session serializer implementation
|
|/ / / /
| | | |
| | | |
| | | |
| | | | |
Rename allowed options to :marshal and :json, for custom serializers
only allow the use of custom classes.
|
|\ \ \ \
| | | | |
| | | | | |
Alternative implementation to make time travel not dependent on mocha
|
| | | | | |
|
| | | | | |
|
| | | | | |
|
| | | | | |
|
| | | | | |
|
|/ / / / |
|
|\ \ \ \
| | | | |
| | | | |
| | | | |
| | | | | |
schneems/schneems/more-explicit-database-config-error
Enhance errors while retrieving database config
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Right now if there is an error retrieving database configuration the intent of the error (what the code was trying to do while you got the error) could be more explicit.
Instead of this error:
```
Invalid DATABASE_URL: nil
(erb):9:in `rescue in <main>'
(erb):6:in `<main>'
/Users/schneems/.rbenv/versions/2.1.0/lib/ruby/2.1.0/erb.rb:850:in `eval'
/Users/schneems/.rbenv/versions/2.1.0/lib/ruby/2.1.0/erb.rb:850:in `result'
/Users/schneems/Documents/projects/rails/railties/lib/rails/application/configuration.rb:98:in `database_configuration'
/Users/schneems/Documents/projects/rails/activerecord/lib/active_record/railtie.rb:41:in `block in <class:Railtie>'
/Users/schneems/Documents/projects/rails/railties/lib/rails/railtie.rb:237:in `instance_exec'
/Users/schneems/Documents/projects/rails/railties/lib/rails/railtie.rb:237:in `block in run_tasks_blocks'
/Users/schneems/Documents/projects/rails/railties/lib/rails/railtie.rb:237:in `each'
/Users/schneems/Documents/projects/rails/railties/lib/rails/railtie.rb:237:in `run_tasks_blocks'
/Users/schneems/Documents/projects/rails/railties/lib/rails/application.rb:339:in `block in run_tasks_blocks'
/Users/schneems/Documents/projects/rails/railties/lib/rails/engine/railties.rb:13:in `each'
```
I propose we issue this error:
```
Cannot load `Rails.application.database_configuration`:
Invalid DATABASE_URL: nil
(erb):9:in `rescue in <main>'
(erb):6:in `<main>'
/Users/schneems/.rbenv/versions/2.1.0/lib/ruby/2.1.0/erb.rb:850:in `eval'
/Users/schneems/.rbenv/versions/2.1.0/lib/ruby/2.1.0/erb.rb:850:in `result'
/Users/schneems/Documents/projects/rails/railties/lib/rails/application/configuration.rb:98:in `database_configuration'
/Users/schneems/Documents/projects/rails/activerecord/lib/active_record/railtie.rb:41:in `block in <class:Railtie>'
/Users/schneems/Documents/projects/rails/railties/lib/rails/railtie.rb:237:in `instance_exec'
/Users/schneems/Documents/projects/rails/railties/lib/rails/railtie.rb:237:in `block in run_tasks_blocks'
/Users/schneems/Documents/projects/rails/railties/lib/rails/railtie.rb:237:in `each'
/Users/schneems/Documents/projects/rails/railties/lib/rails/railtie.rb:237:in `run_tasks_blocks'
/Users/schneems/Documents/projects/rails/railties/lib/rails/application.rb:339:in `block in run_tasks_blocks'
/Users/schneems/Documents/projects/rails/railties/lib/rails/engine/railties.rb:13:in `each'
```
|
| | | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | |
| | | | | | |
Fixing issue with activerecord serialization not being able to dump a record after loading it from YAML - fixes #13861
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
after loading it from YAML - fixes #13861
|
|\ \ \ \ \ \
| |/ / / / /
|/| | | | | |
Added some style changes in asset pipeline documentation
|
| | | | | | |
|
|\ \ \ \ \ \
| |_|_|/ / /
|/| | | | | |
Fix documentation of filters api with classes [ci skip]
|
|/ / / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The api for filters with classes change and the guides weren't updated.
Now the class must respond for methods with the same name as the filter,
so the `before_action` calls a `before` method, and so on.
The method `#filter` has been deprecated in 4.0.0 and has been removed
in 4.1.0: #7560
|
|\ \ \ \ \
| |_|/ / /
|/| | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
`find_in_batches` now returns an `Enumerator`
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/relation/batches.rb
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
so that it
can be chained with other `Enumerable` methods.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Mention find_each in find_in_batches doc [ci skip]
|
|/ / / / / |
|
|\ \ \ \ \
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Raise an error if `scope` or `enum` is about to add a conflicting method to the class
Fixed #13389
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Dangerous name conflicts includes instance or class method conflicts
with methods defined within `ActiveRecord::Base` but not its ancestors,
as well as conflicts with methods generated by other enums on the same
class.
Fixes #13389.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Similar to dangerous attribute methods, a scope name conflict is
dangerous if it conflicts with an existing class method defined within
`ActiveRecord::Base` but not its ancestors.
See also #13389.
*Godfrey Chan*, *Philippe Creux*
|
|/ / / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Before:
>> ActiveRecord::Base.respond_to?(:find_by_something)
NoMethodError: undefined method `abstract_class?' for Object:Class
After:
>> ActiveRecord::Base.respond_to?(:find_by_something)
=> false
|
| | | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Allow session serializer key in config.session_store
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
MessageEncryptor has :serializer option, where any serializer object can
be passed. This commit make it possible to set this serializer from configuration
level.
There are predefined serializers (:marshal_serializer, :json_serialzier)
and custom serializer can be passed as String, Symbol (camelized and
constantized in ActionDispatch::Session namepspace) or serializer object.
Default :json_serializer was also added to generators to provide secure
defalt.
|