Commit Graph

41818 Commits

Author SHA1 Message Date
Kuldeep Aggarwal
1ea0ae6637 removed extra comma [ci skip] 2014-01-14 01:18:00 +05:30
Yves Senn
e0a521cfcd Only lookup config.log_level for stdlib ::Logger. Closes #11665.
This prevents Rails from assigning meaningless log levels to third
party loggers like log4r. If `Rails.logger` is not `kind_of?(::Logger)`
we simply assign the `config.log_level` as is.

This bug was introduced by #11665.
2014-01-13 19:00:45 +01:00
Rafael Mendonça França
4f779e32d8 Merge pull request #13699 from rystraum/dependent-restrict-removal
Updated Changelog to reflect removal of :dependent => :restrict
2014-01-13 09:46:50 -08:00
Rystraum Gamonez
25a9623422 Updated Changelog to reflect removal of :dependent => :restrict
Based on https://github.com/rails/rails/issues/2502, the option has
been removed.
2014-01-14 01:29:26 +08:00
Yves Senn
050f100d07 Merge pull request #13693 from gaurish/typo
[JRuby] Fix incorrect RUBY_ENGINE value
2014-01-13 06:33:25 -08:00
Gaurish Sharma
35e56f6fa5 standardize on jruby_skip & rbx_skip
This Adds helpers(jruby_skip & rbx_skip). In Future, Plan is to use
these helpers instead of calls directly to
RUBY_ENGINE/RbConfig/JRUBY_VERSION
2014-01-13 19:51:47 +05:30
Yves Senn
e95031f55d fix bug in becomes! when changing from base to subclass. Closes #13272. 2014-01-13 15:07:14 +01:00
Yves Senn
ee4b5f1b8a highlight http://localhost:3000 in README.md. Closes #13643. [ci skip]
This has no effect on the API docs. The main API page is taken from:
    railties/RDOC_MAIN.rdoc
2014-01-13 11:50:22 +01:00
Yves Senn
8c0d5e0d1c doc proc/lambda arg on inclusion validation. Closes #13689. [ci skip] 2014-01-13 11:25:58 +01:00
Yves Senn
3a521bc7d1 Merge pull request #13687 from gaurish/spring-has-no-love-for-jruby
Skip Spring App Generator tests on JRuby
2014-01-12 23:44:36 -08:00
Godfrey Chan
2b4ed72225 Merge pull request #13646 from jenseng/json_escape
Clarify behavior of json_escape [ci skip]
2014-01-12 20:50:38 -08:00
David Heinemeier Hansson
c0577eb591 Merge pull request #13673 from senny/use_enum_label_in_forms
use enum labels as form values. Achieved by `_before_type_cast`.
2014-01-12 20:06:12 -08:00
Gaurish Sharma
4aca806017 Skip Spring App Generator tests on JRuby
Spring makes extensive use of Process.fork, so won't be able to provide
JRuby Support, hence skip these tests on JRuby.
2014-01-13 02:58:03 +05:30
Xavier Noria
db11682c2b fixes a typo in a CHANGELOG 2014-01-12 22:24:28 +01:00
Xavier Noria
6049249c6c upgrade SDoc
Kudos to @zzak for taking over SDoc and make it work with RDoc 4.
2014-01-12 22:18:44 +01:00
Xavier Noria
20a795f64d fixes the Gemfile generator templates
The templates were written as if for a given gem you could either pass a version
or options, but not both. But you may want to specify a version and also a group
or whether the gem has to be required, for example.
2014-01-12 22:14:44 +01:00
Andrew White
75c271198a Merge pull request #13668 from prathamesh-sonpatki/issue-13667
Fix iterating over DateTime by doing strict checking for Time objects
2014-01-12 00:24:50 -08:00
Prathamesh Sonpatki
1842a6920f Fix iterating over DateTime by doing strict checking for Time objects
- Fixes #13667
2014-01-11 18:35:38 +05:30
Andrew White
4ae3da66f7 Merge pull request #13671 from arunagw/upgrade-bundler
Removing without_thor_debug
2014-01-11 03:58:25 -08:00
Yves Senn
792c66f868 use enum labels as form values. Achieved by _before_type_cast.
Closes #13650, #13672

This is an alternate implementation to solve #13650. Currently form fields
contain the enum value (eg. "1"). This breaks because the setter `enum=`
expects the label (eg. "active").

ActiveRecord::Enum allows you to use labels in your application but store numbers.
We should make sure that all parts after AR are dealing with labels and not the
underlying mapping to a number.

This patch defines `_before_type_cast` on every enum column to return the label.
This method is later used to fetch the value to display in form fields.

I deliberately copied the implementation of the enum getter instead of delegating to it.
This allows you to overwrite the getter and for example return a `Value Object` but have it
still work for form fields.
2014-01-11 12:57:09 +01:00
Arun Agrawal
b4f9377b3a Removing without_thor_debug
a1d0c0fa3d8ca97edc8f2a1d6ba96af19221dbad

as bundler 1.5.2 is out now
2014-01-11 08:50:31 +01:00
Aaron Patterson
caa981d881 Merge branch 'master' into laurocaetano-fix_send_file
* master: (536 commits)
  doc, API example on how to use `Model#exists?` with multiple IDs. [ci skip]
  Restore DATABASE_URL even if it's nil in connection_handler test
  [ci skip] - error_messages_for has been deprecated since 2.3.8 - lets reduce any confusion for users
  Ensure Active Record connection consistency
  Revert "ask the fixture set for the sql statements"
  Check `respond_to` before delegation due to: d781caaf31
  Adding Hash#compact and Hash#compact! methods
  MySQL version 4.1 was EOL on December 31, 2009 We should at least recommend modern versions of MySQL to users.
  clear cache on body close so that cache remains during rendering
  add a more restricted codepath for templates fixes #13390
  refactor generator tests to use block form of Tempfile
  Fix typo [ci skip]
  Move finish_template as the last public method in the generator
  Minor typos fix [ci skip]
  make `change_column_null` reversible. Closes #13576.
  create/drop test and development databases only if RAILS_ENV is nil
  Revert "Speedup String#to"
  typo fix in test name. [ci skip].
  `core_ext/string/access.rb` test what we are documenting.
  Fix typo in image_tag documentation
  ...

Conflicts:
	actionpack/CHANGELOG.md
2014-01-10 11:00:30 -08:00
Aaron Patterson
bd1bf2c5b8 Merge branch 'ruby-2.2'
* ruby-2.2:
  Check `respond_to` before delegation due to: d781caaf31
2014-01-10 09:30:32 -08:00
Yves Senn
35cc32841e doc, API example on how to use Model#exists? with multiple IDs. [ci skip]
Refs #13658
2014-01-10 09:59:19 +01:00
Yves Senn
8ad1612011 Merge pull request #13657 from leriksen/master
[ci skip] - error_messages_for has been deprecated since 2.3.8 - lets re...
2014-01-09 23:45:33 -08:00
Guillermo Iguaran
07f6a1cd94 Merge pull request #13659 from prathamesh-sonpatki/fix-build
Restore DATABASE_URL even if it's nil in connection_handler test
2014-01-09 20:45:14 -08:00
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
Jon Jensen
7ce6840693 Clarify behavior of json_escape, update examples
The behavior of json_escape was fixed in 2f1c5789, but the doc
changes and example in that commit incorrectly indicated that the
return value would be html-safe. Since quotation marks are
preserved, the raw value is not safe to use in other contexts
(specifically HTML attributes).
2014-01-09 20:35:13 -07:00
leriksen
951bb848be [ci skip] - error_messages_for has been deprecated since 2.3.8 - lets reduce any confusion for users 2014-01-10 12:08:17 +11:00
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
2af5303683 Merge branch 'master' into ruby-2.2
* master:
  Revert "ask the fixture set for the sql statements"
2014-01-09 14:19:43 -08: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
Aaron Patterson
b0acc77edc Check respond_to before delegation due to: d781caaf31 2014-01-09 14:12:05 -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