aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
Commit message (Collapse)AuthorAgeFilesLines
* Remove redundant `self.` in class method callsJack Danger Canty2014-07-301-5/+5
| | | | These are the only instances of this in the whole code base.
* Remove @state.parent assignment on commitArthur Neves2014-07-291-2/+1
| | | | | | | | | This piece of code was introduced on 67d8bb963d5d51fc644d6b1ca20164efb4cee6d7 , which was calling `committed?` in the `transaction_state` before calling the `committed!` method. However on 7386ffc781fca07a0c656db49fdb54678caef809, the `committed?` check was removed and replaced by a `finalized?`, which only checks if the state is not nil. Thus we can remove that line.
* [ci skip] fix doc typo for validates_uniqueness_ofSatoru Yamasaki2014-07-291-1/+1
|
* remove blank lines in the start of the ActiveRecord filesPonomarev Nikolay2014-07-298-8/+0
|
* Merge pull request #16305 from tomkadwill/documented_change_tableRafael Mendonça França2014-07-281-1/+1
|\ | | | | Added documentation for change_table
| * Added nodoc to change_tableTom Kadwill2014-07-281-1/+1
| |
* | Extract the transaction class to a local variableRafael Mendonça França2014-07-281-6/+2
| |
* | Merge pull request #16284 from arthurnn/transactionsRafael Mendonça França2014-07-284-62/+101
|\ \ | | | | | | | | | Transactions refactoring
| * | savepoint_name should return nil for non-savepoint transactionsArthur Neves2014-07-283-4/+27
| | | | | | | | | | | | Also add test to assets the savepoint name
| * | Transactions refactoringArthur Neves2014-07-283-38/+65
| | | | | | | | | | | | | | | | | | | | | Add a transaction manager per connection, so it can controls the connection responsibilities. Delegate transaction methods to transaction_manager
| * | Remove finishing? method from transaction.Arthur Neves2014-07-242-24/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The finishing variable on the transaction object was a work-around for the savepoint name, so after a rollback/commit the savepoint could be released with the previous name. related: 9296e6939bcc786149a07dac334267c4035b623a 60c88e64e26682a954f7c8cd6669d409ffffcc8b
* | | Fix typo and remove code block since present is not a method.Rafael Mendonça França2014-07-281-1/+1
| | |
* | | docs, clarify attribute query methods on numeric columns. Closes #16246.Yves Senn2014-07-281-0/+1
| | | | | | | | | | | | [ci skip]
* | | Merge pull request #16297 from calebthompson/extract-iterator-methodRafael Mendonça França2014-07-281-10/+14
|\ \ \ | | | | | | | | Extract iterator method in AR::SchemaDumper
| * | | Extract iterator method in AR::SchemaDumperCaleb Thompson2014-07-251-10/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Gems which wish to tie into ActiveRecord::SchemaDumper need to duplicate this logic currently. [Foreigner] is one such example, as is a library I'm currently working on but which hasn't been released yet: def tables_with_foreign_keys(stream) tables_without_foreign_keys(stream) @connection.tables.sort.each do |table| next if ['schema_migrations', ignore_tables].flatten.any? do |ignored| case ignored when String; table == ignored when Regexp; table =~ ignored else raise StandardError, 'ActiveRecord::SchemaDumper.ignore_tables accepts an array of String and / or Regexp values.' end end foreign_keys(table, stream) end end [Foreigner]: https://github.com/matthuhiggins/foreigner/blob/master/lib/foreigner/schema_dumper.rb#L36-L43 Extract the skip logic to a method, making it much simpler to follow this same behavior in gems that are tying into the migration flow and let them dump only tables that aren't skipped without copying this block of code. The above code could then be simplified to: def tables_with_foreign_keys(stream) tables_without_foreign_keys(stream) @connection.tables.sort.each do |table| foreign_keys(table, stream) unless ignored?(table) end end It also, in my opinion, simplifies the logic on ActiveRecord's side, and clarifies the intent of the skip logic.
* | | | Merge pull request #16295 from kenn/no_stacktrace_drop_taskRafael Mendonça França2014-07-282-0/+8
|\ \ \ \ | | | | | | | | | | | | | | | No verbose backtrace by db:drop when database does not exist.
| * | | | No verbose backtrace by db:drop when database does not exist.Kenn Ejima2014-07-272-0/+8
| | | | |
* | | | | Add where condition so select_one returns the correct record.Zuhao Wan2014-07-281-1/+1
| | | | |
* | | | | [ci skip] Fix documentation for @macro and reflection typeseileencodes2014-07-272-7/+10
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since `@macro` doesn't exist anymore and these reflections are no longer AssociationReflections but their own types of reflections based on macro I updated the documentation to match the changes I made in #16089 and #16198. An `AssociationReflection` that had a `@macro` of `:has_many` now is a `HasManyReflection`
* | | | Merge pull request #16290 from a3gis/masterZachary Scott2014-07-252-2/+2
|\ \ \ \ | |/ / / |/| | | [ci skip] Fix documentation of SQLite3Adapter.columns where SQLite3Column was removed in e781aa31fc52a7c696115302ef4d4e02bfd1533b
| * | | Remove references to SQLite3Column from documentationa3gis2014-07-251-1/+1
| | | |
| * | | Fix documentation of SQlite3Adapter.columnsa3gis2014-07-251-1/+1
| | | | | | | | | | | | As of https://github.com/rails/rails/commit/e781aa31fc52a7c696115302ef4d4e02bfd1533b SQLite3Column has been dropped.
* | | | Merge pull request #16220 from pcreux/postgresql-jsonb-supportYves Senn2014-07-256-9/+64
|\ \ \ \ | |_|/ / |/| | | | | | | Add support for Postgresql JSONB
| * | | Add support for Postgresql JSONBPhilippe Creux2014-07-246-9/+64
|/ / / | | | | | | | | | [Philippe Creux, Chris Teague]
* | | tests, run adapter specific rake tests only for the right adapter.Yves Senn2014-07-243-0/+6
| | |
* | | build fix, fix error introduced with 091b246bb0111357edbb9703ea342a944b04deb6Yves Senn2014-07-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes the following issue: 1) Failure: ActiveRecord::MySQLPurgeTest#test_establishes_connection_to_test_database [test/cases/tasks/mysql_rake_test.rb:200]: not all expectations were satisfied unsatisfied expectations: - expected exactly once, not yet invoked: ActiveRecord::Base.establish_connection(:test) satisfied expectations: - allowed any number of times, invoked once: #<Mock:0x2349430>.recreate_database(any_parameters) - allowed any number of times, invoked once: ActiveRecord::Base.establish_connection(any_parameters) - allowed any number of times, invoked once: ActiveRecord::Base.connection(any_parameters)
* | | fix, mysql `db:purge` respects `Rails.env`.Yves Senn2014-07-242-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously this method always established a connection to the test database. This resulted in buggy behavior when combined with other tasks like `bin/rake db:schema:load`. This was one of the reasons why #15394 (22e9a91189af2c4e6217a888e77f22a23d3247d1) was reverted: > I’ve replicated it on a new app by the following commands: 1) rails generate model post:title, 2) rake db:migrate, 3) rake db:schema:load, 4) rails runner ‘puts Post.first’. The last command goes boom. Problem is that rake db:schema:load wipes the database, and then doesn’t actually restore it. This is all on MySQL. There’s no problem with SQLite. -- DHH https://github.com/rails/rails/commit/22e9a91189af2c4e6217a888e77f22a23d3247d1#commitcomment-6834245
* | | clenaup, unify CHANGELOG format. [ci skip]Yves Senn2014-07-241-5/+7
| | |
* | | Merge pull request #16280 from a3gis/masterMatthew Draper2014-07-241-2/+2
|\| | | | | | | | Fixes #16265 and correct documentation typo
| * | Fix documentation typo in ConnectionSpecification::Resolve.speca3gis2014-07-241-1/+1
| | |
| * | Fixes #16265a3gis2014-07-241-1/+1
| | |
* | | pg, `change_column_default, :table, :column, nil` issues `DROP DEFAULT`.Yves Senn2014-07-242-1/+16
|/ / | | | | | | | | | | | | | | | | | | | | | | Closes #16261. [Matthew Draper, Yves Senn] Using `DEFAULT NULL` results in the same behavior as `DROP DEFAULT`. However, PostgreSQL will cast the default to the columns type, which leaves us with a default like "default NULL::character varying". /cc @matthewd
* | Merge pull request #16231 from Envek/type_in_referencesYves Senn2014-07-226-5/+56
|\ \ | | | | | | | | | | | | | | | * Allow to specify a type for foreign key column in migrations * unified the docs * some cleanup in CHANGELOG
| * | Allow to specify a type for foreign key column in migrationsAndrey Novikov2014-07-226-3/+46
|/ / | | | | | | [Andrey Novikov & Łukasz Sarnacki]
* | Merge pull request #16253 from ↵Yves Senn2014-07-221-1/+1
|\ \ | | | | | | | | | | | | zuhao/refactor_activerecord_nested_through_associations_test Make sure assertion passes for postgresql.
| * | Make sure assertion passes for postgresql.Zuhao Wan2014-07-221-1/+1
| | |
* | | Remove redundant that already happened in teardown.Zuhao Wan2014-07-221-1/+0
|/ /
* | build fix, remove not null constraint.Yves Senn2014-07-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | The fixtures are still in play, adding a new column without a default and `null: true` is not possible. This reverts back to leaking global state, as our `schema.rb` adds the `null: false` constraint on this field. A future solution would be to make the `migration_test.rb` run independent of fixture tables. This way we can simply drop the state after test execution, without worrying about side effects. /cc @zuhao
* | Merge pull request #16250 from zuhao/refactor_activerecord_migration_testYves Senn2014-07-221-1/+1
|\ \ | | | | | | Remove length limit that results failure in other tests.
| * | Remove length limit that results failure in other tests.Zuhao Wan2014-07-221-1/+1
| | |
* | | Remove the side-effects of validates_presence_of.Zuhao Wan2014-07-221-2/+3
|/ /
* | Touch option description grammatical error fixed [ci skip]vadivelan2014-07-211-1/+1
| |
* | Merge branch 'rm-remove-mocha'Rafael Mendonça França2014-07-191-0/+2
|\ \ | | | | | | | | | | | | Conflicts: actionpack/test/abstract_unit.rb
| * | Stop requiring mocha automaticallyRafael Mendonça França2014-07-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We are planning to remove mocha from our test suite because of performance problems. To make this possible we should stop require mocha on ActionSupport::TestCase. This should not affect applications since users still need to add mocha to Gemfile and this already load mocha. Added FIXME notes to place that still need mocha removal
* | | Merge pull request #16227 from Aguynamedsteve/typo_correctionYves Senn2014-07-191-1/+1
|\ \ \ | | | | | | | | Fixed typo in comment [ci skip]
| * | | Fixed typo in commentSteve2014-07-191-1/+1
| | | |
* | | | create_join_table uses same logic as HABTM reflectionsStefan Kanev2014-07-185-2/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change, create_join_table would not remove the common prefix in the join table name, unlike ActiveRecord::Reflections. A HABTM between Music::Artist and Music::Record would use a table music_artists_records, while create_join table would create music_artists_music_records.
* | | | Merge pull request #15762 from arthurnn/better_error_on_bad_alias_methodMatthew Draper2014-07-183-10/+27
|\ \ \ \ | | | | | | | | | | | | | | | Dont swallow errors when bad alias_method
| * | | | Dont swallow errors when bad alias_methodArthur Neves2014-06-243-10/+27
| | | | |
* | | | | Disable some tests on SQLiteRafael Mendonça França2014-07-171-77/+77
| | | | | | | | | | | | | | | | | | | | | | | | | These tests were passing before because the precision were not using to cast the value. Not it is being used so it would fail on sqlite3