Commit Graph

41738 Commits

Author SHA1 Message Date
Prathamesh Sonpatki
1842a6920f Fix iterating over DateTime by doing strict checking for Time objects
- Fixes #13667
2014-01-11 18:35:38 +05:30
Prathamesh Sonpatki
e633cdb34a Restore DATABASE_URL even if it's nil in connection_handler test
- We have to restore DATABASE_URL to its previous state irrespective of
  previous value is nil or not
2014-01-10 10:06:19 +05:30
Rafael Mendonça França
8a5b480ebb Merge pull request #13582 from schneems/schneems/preserve-connection-behavior
Ensure Active Record connection consistency
2014-01-09 14:37:51 -08:00
schneems
6cc03675d3 Ensure Active Record connection consistency
Currently Active Record can be configured via the environment variable `DATABASE_URL` or by manually injecting a hash of values which is what Rails does, reading in `database.yml` and setting Active Record appropriately. Active Record expects to be able to use `DATABASE_URL` without the use of Rails, and we cannot rip out this functionality without deprecating. This presents a problem though when both config is set, and a `DATABASE_URL` is present. Currently the `DATABASE_URL` should "win" and none of the values in `database.yml` are used. This is somewhat unexpected to me if I were to set values such as `pool` in the `production:` group of `database.yml` they are ignored.

There are many ways that active record initiates a connection today:

- Stand Alone (without rails)
  - `rake db:<tasks>`
  - ActiveRecord.establish_connection
 
- With Rails
  - `rake db:<tasks>`
  - `rails <server> | <console>`
  - `rails dbconsole`


We should make all of these behave exactly the same way. The best way to do this is to put all of this logic in one place so it is guaranteed to be used.

Here is my prosed matrix of how this behavior should work:

```
No database.yml
No DATABASE_URL
=> Error
```

```
database.yml present
No DATABASE_URL
=> Use database.yml configuration
```

```
No database.yml
DATABASE_URL present
=> use DATABASE_URL configuration
```

```
database.yml present
DATABASE_URL present
=> Merged into `url` sub key. If both specify `url` sub key, the `database.yml` `url`
   sub key "wins". If other paramaters `adapter` or `database` are specified in YAML,
   they are discarded as the `url` sub key "wins".
```

### Implementation

Current implementation uses `ActiveRecord::Base.configurations` to resolve and merge all connection information before returning. This is achieved through a utility class: `ActiveRecord::ConnectionHandling::MergeAndResolveDefaultUrlConfig`.

To understand the exact behavior of this class, it is best to review the behavior in activerecord/test/cases/connection_adapters/connection_handler_test.rb though it should match the above proposal.
2014-01-09 16:35:37 -06:00
Aaron Patterson
da65fe9e11 Revert "ask the fixture set for the sql statements"
This reverts commit 026d0555685087845b74dd87a0417b5a164b1c13.

Conflicts:
	activerecord/lib/active_record/fixtures.rb

Fixes #13383
2014-01-09 14:17:04 -08:00
Rafael Mendonça França
a67f25d50b Merge pull request #13632 from tinogomes/master
Adding Hash#compact and Hash#compact! methods
2014-01-09 10:14:25 -08:00
tinogomes
5121593787 Adding Hash#compact and Hash#compact! methods
* Adding Hash#compact and Hash#compact! methods
  * Using Ruby 1.9 syntax on documentation
  * Updating guides for `Hash#compact` and `Hash#compact!` methods
  * Updating CHANGELOG for ActiveSupport
  * Removing unecessary protected method and lambda for `Hash#compact` implementations
  * Performing `Hash#compact` implementation - https://gist.github.com/tinogomes/8332883
  * fixing order position
  * Fixing typo
2014-01-09 16:02:55 -02:00
Guillermo Iguaran
4c32b72951 Merge pull request #13644 from zzak/doc_mysql_config_template
MySQL version 4.1 was EOL on December 31, 2009 [ci-skip]
2014-01-08 18:42:09 -08:00
Zachary Scott
7d414eaa9c MySQL version 4.1 was EOL on December 31, 2009
We should at least recommend modern versions of MySQL to users.
2014-01-08 18:38:38 -08:00
Aaron Patterson
e176353b71 clear cache on body close so that cache remains during rendering
fixes #13547

The body may use the local cache during rendering.  `call`ing the app
doesn't mean that rendering is finished, so we need to wait until
`close` is called on the body.
2014-01-08 15:48:19 -08:00
Aaron Patterson
2875b4a66e add a more restricted codepath for templates fixes #13390 2014-01-08 15:07:15 -08:00
Rafael Mendonça França
e4e750ba1a Merge pull request #13637 from craftsmen/app-generator-minor-fix
Move finish_template as the last public method defined in the generator
2014-01-08 13:37:12 -08:00
Aaron Patterson
65251820ef refactor generator tests to use block form of Tempfile 2014-01-08 12:05:52 -08:00
Carlos Antonio da Silva
8bbd21cccf Merge pull request #13634 from jwworth/master
Fix typo [ci skip]
2014-01-08 11:57:31 -08:00
Jake Worth
de535226e8 Fix typo [ci skip] 2014-01-08 13:47:20 -06:00
Mehdi Lahmam
87628654f0 Move finish_template as the last public method in the generator 2014-01-08 19:51:05 +01:00
Robin Dupret
f4fc9e65ed Minor typos fix [ci skip] 2014-01-08 16:40:49 +01:00
Yves Senn
724509a9d5 make change_column_null reversible. Closes #13576.
Closes #13623.
2014-01-08 15:51:06 +01:00
Yves Senn
b502e3db95 Merge pull request #13629 from dmathieu/drop_test
Be more explicit about the default of db:drop and db:create
2014-01-08 05:39:35 -08:00
Damien Mathieu
a334425caf create/drop test and development databases only if RAILS_ENV is nil
Closes #13625
2014-01-08 14:37:07 +01:00
Yves Senn
a03fed88f7 Revert "Speedup String#to"
This reverts commit 2ef1fb2c455ca53a0c1e1768f50824926ce28bd3.

As described in PR #13627 this commit broke functionality when passing
a negative Fixnum to the `String#to` method:

```ruby
assert_equal "hell", s.to(-2)
```

Before the revert, this failed with:

```
  1) Failure:
StringAccessTest#test_#to_with_negative_Fixnum,_position_is_counted_from_the_end [test/core_ext/string_ext_test.rb:275]:
Expected: "hell"
  Actual: nil
```

This revert is to keep the functionality on `master` working.
If there is another way to get the performance benefit and keep
the documented functionality we can add that.

/cc @amatsuda @carlosantoniodasilva
2014-01-08 11:27:43 +01:00
Yves Senn
40a83d740f typo fix in test name. [ci skip]. 2014-01-08 11:15:59 +01:00
Yves Senn
e37f16444a core_ext/string/access.rb test what we are documenting.
I also extracted the tests from a single bulk method into a separate test-case.
The new tests cover the API described in the docs.

There are two skipped tests, which are broken as of 2ef1fb2c455ca53a0c1e1768f50824926ce28bd3
* #to with negative Fixnum, position is counted from the end
* #from and #to can be combined

This was brought to my attention by #13627.

Closes #13627.
2014-01-08 10:25:40 +01:00
Rafael Mendonça França
f12413295b Merge pull request #13355 from dylanahsmith/migration-version
activerecord: Initialize Migration with version from MigrationProxy.

Conflicts:
	activerecord/CHANGELOG.md
2014-01-07 18:44:51 -02:00
Xavier Noria
032ab5064b Merge pull request #13621 from Intrepidd/patch-1
Fix typo in image_tag documentation [ci skip]
2014-01-07 03:48:25 -08:00
Adrien
98c3586415 Fix typo in image_tag documentation
image_tag only supports :alt and :size as additional keys, not three.
2014-01-07 12:38:24 +01:00
Yves Senn
ab21f42245 Merge pull request #13597 from prathamesh-sonpatki/hstore_migration
Make change_table use object of current database adapter
2014-01-07 03:08:03 -08:00
Nishant Modak
eb589fed6f Make change_table use object of current database adapter
- Earlier, change_table was creating database-agnostic object.
  - After this change, it will create correct object based on current
    database adapter.
  - This will ensure that create_table and change_table will get same objects.
  - This makes update_table_definition method public and nodoc.
  - Fixes #13577 and #13503
2014-01-07 15:57:21 +05:30
Carlos Antonio da Silva
3a33e8ea85 Use a better method name to check the requirement of password confirmation
Also improve changelog entries related to secure password to proper
highlight.
2014-01-07 07:59:44 -02:00
Rafael Mendonça França
017b0fb08a Merge pull request #13617 from arthurnn/error_var
Add 'e' var on rescue DalliError, in order to log it
2014-01-06 09:50:58 -08:00
Arthur Neves
f3748c886a Add 'e' var on rescue DalliError, in order to log it 2014-01-06 12:47:47 -05:00
Dylan Thacker-Smith
06ace1e2b5 activerecord: Initialize Migration with version from MigrationProxy. 2014-01-06 10:46:35 -05:00
Rafael Mendonça França
ca98d0d486 Merge pull request #13616 from zirni/remove_warnings
Remove warnings in test suite
2014-01-06 07:44:14 -08:00
Matthias Zirnstein
2a0fdde380 Remove warnings in test suite
lib/active_record/store.rb:79: warning: method redefined; discarding old color=
lib/active_record/store.rb:79: warning: previous definition of color= was here
lib/active_record/store.rb:83: warning: method redefined; discarding old color
lib/active_record/store.rb:83: warning: previous definition of color was here
2014-01-06 16:40:32 +01:00
Yves Senn
f2b80a41b5 Merge pull request #13593 from oliveiraethales/store_yaml_coder
Fix: ActiveRecord::Store TypeError conversion when using YAML coder
2014-01-06 05:43:14 -08:00
Thales Oliveira
901a0c8b4a Fix: ActiveRecord::Store TypeError conversion when using YAML coder
Renaming the test accordingly to its behaviour

Adding 'Fixes' statement to changelog

Improving tests legibility & changelog

Undoing mistakenly removed empty line & further improving changelog
2014-01-06 11:36:19 -02:00
Yves Senn
2d1d426c67 add example to the CHANGELOG entry from 3a48b83e5 [ci skip].
/cc @pixeltrix
2014-01-06 14:18:53 +01:00
Carlos Antonio da Silva
6bf93b22d5 Fix typo in AS changelog, improve highlight [ci skip] 2014-01-06 10:28:44 -02:00
Carlos Antonio da Silva
5d238ea926 Fix AR connection resolver docs to return a hash with string keys [ci skip] 2014-01-06 09:15:11 -02:00
Carlos Antonio da Silva
28161b7c88 Fix typo [ci skip] 2014-01-06 09:07:44 -02:00
Carlos Antonio da Silva
16a27b68ea Fix rdoc markup [ci skip]
Wrapping symbols with + does not work, we must use <tt> instead.
2014-01-06 08:50:33 -02:00
Yves Senn
1ce0a2a68a Merge pull request #13611 from robinboening/plugin_generator_tests
Add missing tests for invalid names in `rails plugin new` generator
2014-01-06 02:49:40 -08:00
Carlos Antonio da Silva
a6da73f975 Fix typo in AMo docs [ci skip] 2014-01-06 08:45:21 -02:00
Robin Böning
6cc087b28d Add missing tests for invalid names in rails plugin new
* Test for: Invalid plugin name, because of reserved rails word.
* Test for: Invalid plugin name because of constant name that is already in use.
2014-01-06 11:28:04 +01:00
Yves Senn
535bd55fcd quick formatting pass through CHANGELOGS. [ci skip]. 2014-01-06 10:57:00 +01:00
Yves Senn
2229c523aa update 4.1 release notes with deprecation commit link. [ci skip] 2014-01-06 10:00:40 +01:00
Guillermo Iguaran
ad142aed49 Merge pull request #13607 from huoxito/actionview-version
Require actionview/version
2014-01-05 21:55:55 -08:00
Washington Luiz
a5d92e6a1d Require actionview/version
just like all the other modules do require their version file
2014-01-06 02:52:46 -03:00
Rafael Mendonça França
d2cee1e4cc Merge pull request #13604 from randomecho/docs-getting-started
Ruby is a proper noun here, not part of code fragment [ci skip]
2014-01-05 16:41:32 -08:00
Soon Van
44473e49a8 Ruby is a proper noun here, not part of code fragment [ci skip]
Last line of note also relates heavily to first part
and parenthesis broke reading flow.
2014-01-05 18:42:14 -05:00