Commit Graph

41530 Commits

Author SHA1 Message Date
Juanito Fatas
b58c8d36b7 [ci skip] Update getting started Ruby version. 2013-12-24 20:33:23 +08:00
José Valim
ec11807368 Deprecate use of string in establish_connection as connection lookup 2013-12-24 10:18:54 +01:00
José Valim
d2ed433b0a Only build a ConnectionSpecification if required 2013-12-24 10:02:07 +01:00
José Valim
d8336cab32 Fix build failures related to the new ENV options in yml 2013-12-24 09:26:34 +01:00
Akira Matsuda
222f00b422 Unused classes in AV tests 2013-12-24 11:04:49 +09:00
Xavier Noria
fa0380cb4a AC::Parameters#permit! permits hashes in array values 2013-12-23 22:55:03 +01:00
José Valim
33cb2f334d Merge pull request #13463 from josevalim/jv-env
Do not store production information in .yml files
2013-12-23 12:28:04 -08:00
Carlos Antonio da Silva
7530c82e82 Disable locale checks to avoid warnings in Active Model tests [ci skip]
Missed AMo when adding to the other components in
ae196e85ee7169700afac2eecdc276bc06b10b8d.
2013-12-23 17:51:07 -02:00
José Valim
2d4cfb2840 Update CHANGELOG [ci skip] 2013-12-23 20:34:11 +01:00
José Valim
f6e363309a Use the new Resolver API in dbconsole 2013-12-23 20:32:44 +01:00
José Valim
facf2b47a4 Add examples and namespace ENV options with "RAILS_" 2013-12-23 20:27:17 +01:00
José Valim
c390e60811 Guarantee the connection resolver handles string values
This commit also cleans up the rake tasks that were checking
for DATABASE_URL in different places.

In fact, it would be nice to deprecate DATABASE_URL usage in the long
term, considering the direction we are moving of allowing those in .yml
files.
2013-12-23 20:15:52 +01:00
Carlos Antonio da Silva
9e1740af9c Tidy up fix for PG extensions quoting
Always pass in the column for quote_bound_value and quote using it in
case it exists there.
2013-12-23 16:28:35 -02:00
Tadas Tamosauskas
73bba4c1e1 Serialize postgres' hstore, json and array types correctly in AR update methods.
Fixes #12261. Closes #12395.

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/test/cases/adapters/postgresql/array_test.rb
	activerecord/test/cases/adapters/postgresql/json_test.rb
2013-12-23 16:27:54 -02:00
Carlos Antonio da Silva
56510091fb Do not consider PG array columns as number or text columns
The code uses these checks in several places to know what to do with a
particular column, for instance AR attribute query methods has a branch
like this:

    if column.number?
      !value.zero?
    end

This should never be true for array columns, since it would be the same
as running [].zero?, which results in a NoMethodError exception.

Fixing this by ensuring that array columns in PostgreSQL never return
true for number?/text? checks.

Since most of the array support was based on the postgres_ext lib, it's
worth noting it does the same thing for numeric array columns too:

https://github.com/dockyard/postgres_ext/blob/v1.0.0/lib/postgres_ext/active_record/connection_adapters/postgres_adapter.rb#L72

This extended the same logic for text columns to ensure consistency.
2013-12-23 16:26:15 -02:00
Carlos Antonio da Silva
618d5317d3 Move the null mime type to request.format
TLDR: always return an object that responds to the query methods from
request.format, and do not touch Mime::Type[] lookup to avoid bugs.

---

Long version:

The initial issue was about being able to do checks like
request.format.html? for request with an unknown format, where
request.format would be nil.

This is where the issue came from at first in #7837 and #8085
(merged in cba05887dc3b56a46a9fe2779b6b228880b49622), but the
implementation went down the path of adding this to the mime type
lookup logic.

This unfortunately introduced subtle bugs, for instance in the merged
commit a test related to send_file had to be changed to accomodate the
introduction of the NullType.

Later another bug was found in #13064, related to the content-type being
shown as #<Mime::NullType:...> for templates with localized extensions
but no format included. This one was fixed in #13133, merged in
43962d6ec50f918c9970bd3cd4b6ee5c7f7426ed.

Besides that, custom handlers were not receiving the proper template
formats anymore when passing through the rendering process, because of
the NullType addition. That was found while migrating an application
from 3.2 to 4.0 that uses the Markerb gem (a custom handler that
generates both text and html emails from a markdown template).

---

This changes the implementation moving away from returning this null
object from the mime lookup, and still fixes the initial issue where
request.format.zomg? would raise an exception for unknown formats due to
request.format being nil.
2013-12-23 16:16:49 -02:00
Godfrey Chan
ed334d9a33 Merge pull request #13462 from JuanitoFatas/getting-started
[ci skip] a destroy action in controller, not delete [getting_stated.md].
2013-12-23 10:13:51 -08:00
José Valim
d22a359a18 Do not store production information in .yml files
Instead, read information from environment variables.
2013-12-23 18:54:39 +01:00
Juanito Fatas
7c09ac7104 [ci skip] a destroy action in controller, not delete [getting_stated.md]. 2013-12-24 01:45:15 +08:00
Yves Senn
f4f496dfeb Merge pull request #13427 from schneems/schneems/cannot-connect-postgres-error
Tell how to Create a Database in Error Message
2013-12-23 07:28:40 -08:00
schneems
0ec45cd15d Tell how to Create a Database in Error Message
Currently if you attempt to use a database that does not exist  you get an error:

```
PG::ConnectionBad FATAL:  database "db_error" does not exist
```

The solution is easy, create and migrate your database however new developers may not know these commands by memory. Instead of requiring the developer to search for a solution, tell them how to fix the problem in the error message:

```
ActiveRecord::NoDatabase: FATAL:  database "db_error" does not exist
Run `$ bin/rake db:create db:migrate` to create your database
```

Active Record should not know about `rake db:migrate` so this additional information needs to come from the railtie. Potential alternative implementation suggestions are welcome.
2013-12-23 10:23:48 -05:00
Carlos Antonio da Silva
b4d7be95e6 Fix comment example in AR enum [ci skip] 2013-12-23 13:18:06 -02:00
Yves Senn
32c8aee04b Merge pull request #13455 from jetthoughts/13445_fix_touch_destroyed_record
On destroying do not touch destroyed belongs to association.
2013-12-23 05:50:51 -08:00
Paul Nikitochkin
2bcf7158d3 On destroying do not touch destroyed belongs to association.
Fixes: #13445
2013-12-23 15:44:48 +02:00
Yves Senn
00fc64a6dc Merge pull request #13446 from kuldeepaggarwal/resolver-test-cases
Resolver test cases
2013-12-23 05:14:14 -08:00
Kuldeep Aggarwal
34f17b871e added test cases for Resolver#connection_url_to_hash 2013-12-23 16:45:00 +05:30
José Valim
72503e671f Merge pull request #13457 from strzalek/add-missing-av-railtie
Add missing av/railtie require
2013-12-23 00:03:47 -08:00
Łukasz Strzałkowski
2e033e2799 Add missing av/railtie require 2013-12-22 22:54:51 +01:00
Yves Senn
1a6089f305 CHANGELOG entry for #13451. [ci skip] 2013-12-22 18:44:42 +01:00
Yves Senn
c0a6ffb799 Merge pull request #13451 from dmathieu/quoting_non_strings
Fix typecasting array of integers
2013-12-22 09:14:06 -08:00
Damien Mathieu
1f6a9b50ee fix quoting non-strings
Closes #13444
2013-12-22 17:00:50 +01:00
Godfrey Chan
7432d32f52 Use the same enum definition in the docs and in the comments [ci skip] 2013-12-22 03:53:39 -08:00
Andrew White
cbd4bc84af Add comments with urls for email previews 2013-12-22 10:06:12 +00:00
Guillermo Iguaran
6f4a556bf5 Merge pull request #13443 from schneems/schneems/fix-master-tests
Fix DB Console tests
2013-12-21 22:53:05 -08:00
schneems
dd93a5f459 Use Full path to sqlite database in tests 2013-12-22 00:56:59 -05:00
schneems
a1f9ae5eb8 Fix DB Console tests
The build is broken: https://travis-ci.org/rails/rails/builds/15824530

This commit fixes it.

The problem: Sqlite expects the `database` part to be an absolute path. That prompted this change to be committed to master: fbb79b517f

This change provides correct behavior. Unfortunately tests were introduced in 971d5107cd that were relying on the incorrect behavior. We can avoid the fix by changing to another database url such as `mysql` or `postgresql`

In addition to fixing the failure, the assertions are changed so that the "expected" value comes before "actual" value.
2013-12-21 23:09:01 -05:00
Guillermo Iguaran
6d255b741c Merge pull request #13438 from vipulnsward/enable-memache-on-travis
Enable memcached service on travis for running cache tests.
2013-12-21 10:59:04 -08:00
Guillermo Iguaran
82053bee36 Merge pull request #13436 from robin850/patch-11
Add missing changelog entries and fix few typos
2013-12-21 10:56:29 -08:00
Vipul A M
5724464731 Enable memcached service on travis for running cache tests. 2013-12-22 00:16:34 +05:30
Robin Dupret
b894b7b90a Fix few typos in the documentation [ci skip] 2013-12-21 18:59:55 +01:00
Carlos Antonio da Silva
b9c9766cd4 Fix typo [ci skip] 2013-12-21 15:03:32 -02:00
Robin Dupret
d39db9da1a Add a changelog entry for #13326 [ci skip] 2013-12-21 14:49:16 +01:00
Xavier Noria
273045d6d5 optimizes array conversion in AC::Parameters 2013-12-21 14:22:08 +01:00
Robin Dupret
2bc88d4f74 Add a changelog entry for #13363 [ci skip] 2013-12-21 14:03:14 +01:00
Xavier Noria
269424b0bb refactors AC::Parameters#fetch
AC::Parameters#fetch was refactored in 7171111 to prevent self mutation, but
in doing so it hardcodes logic #convert_hashes_to_parameters is supposed to
encapsulate.

Better leave the delegation, and add a way to avoid mutating self in there.
2013-12-21 13:47:26 +01:00
Guillermo Iguaran
e219bf0ebc Test with 2.1.0-rc1 2013-12-20 22:21:28 -05:00
David Heinemeier Hansson
f39fce5b7d Merge pull request #13425 from kassio/master
Generates html and text templates for mailers by default.
2013-12-20 17:23:38 -08:00
Xavier Noria
92f9ff8cc3 converts hashes in arrays of unfiltered params to unpermitted params [fixes #13382] 2013-12-21 01:16:38 +01:00
Aaron Patterson
fbb79b517f fix url connections for sqlite3 2013-12-20 16:13:34 -08:00
Kassio Borges
02c814c992 html and text templates for mailers by default 2013-12-20 18:34:57 -02:00