Commit Graph

9622 Commits

Author SHA1 Message Date
Arun Agrawal f593b695fe rbconfig is not used in these files
remove unused requires
2013-12-26 21:18:14 +01:00
Chun-wei Kuo fbbd4e1899 Improve font of some code in API documentation [ci skip]
* Add "<tt>" or "+" to improve font of some code and filenames in API documentation
* Does not contain wording changes
2013-12-26 18:54:46 +08:00
schneems d0926d3d5e fix 2.1.0 bug :( 2013-12-25 18:27:09 -05:00
schneems 707be603cf ensure environment is run before db:structure:load
Right now `db:drop` depends on `load_config` since so when `db:drop` gets executed `load_config` gets run. `db:structure:load` depends on `[:environment, :load_config]`. So before it runs, it executes `environment` but because `load_config` has already executed it is skipped. Note `db:load_config` is "invoke"-d twice, but only "execute"-d once:

```
** Invoke db:drop (first_time)
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:drop
** Invoke db:structure:load (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config
** Execute db:structure:load
```

The fix for this is making sure that the environment is run before any `load_config`:

```
** Invoke environment (first_time)
** Execute environment
** Invoke db:drop (first_time)
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:drop
** Invoke db:structure:load (first_time)
** Invoke environment
** Invoke db:load_config
** Execute db:structure:load
```
2013-12-25 18:03:55 -05:00
schneems ba882934bb Partial fix of database url tests
Prior to #13463 when `DATABASE_URL` was set, Rails automagically used that value instead of the database.yml. There are tests in dbs_test that expect this to still be true. After that PR, `RAILS_DATABASE_URL` is expected to be read into the YAML file via ERB, this PR fixes that behavior.

Note: this does not entirely fix the tests. It seems that `ActiveRecord::Tasks::DatabaseTasks.current_config` does not process the url string correctly (convert it into a hash), and ` ActiveRecord::Tasks::DatabaseTasks.structure_load(current_config, filename)` as well as other methods in `DatabaseTasks` expect a hash.

It seems like we should involve the resolver somewhere in this process to correctly convert the database url, I do not know the best place for that /cc @josevalim
2013-12-25 18:03:55 -05:00
Guillermo Iguaran d80ad96b95 Fix tests names: tokens.yml => secrets.yml 2013-12-25 17:34:25 -05:00
Kuldeep Aggarwal b9d79b1f5f using symbol instead of string in establish_connection 2013-12-25 15:24:25 +05:30
José Valim f89c5f46b5 Revert "Ensure secret_key_base is set for all environments"
A better solution has been pushed to master.

This reverts commit 959cfcef72.
2013-12-24 19:29:31 +01:00
José Valim db22a5a8eb Merge pull request #13472 from schneems/schneems/fix-master-database-url-tests
Fix railties tests in master
2013-12-24 10:20:51 -08:00
José Valim df09ce966e Merge pull request #13471 from schneems/schneems/better-secrets-error-message
Better missing `secret_key_base` error message
2013-12-24 08:22:30 -08:00
schneems 14c175c572 Fix railties tests in master
Tests are failing due to missing env var on master https://travis-ci.org/rails/rails/jobs/15930622#L641

This adds an environment variable `ENV['RAILS_SECRET_KEY_BASE']` so these tests will pass.
2013-12-24 11:13:47 -05:00
schneems d641a0cf0d Better missing `secret_key_base` error message
Previously the error was:

```
RuntimeError: You must set secret_key_base in your app's config
```

Will now be:


```
RuntimeError: Missing `secret_key_base` for 'production' environment, set this value in `config/secrets.yml`
```
2013-12-24 11:08:16 -05:00
José Valim 959cfcef72 Ensure secret_key_base is set for all environments 2013-12-24 16:35:43 +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
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 d22a359a18 Do not store production information in .yml files
Instead, read information from environment variables.
2013-12-23 18:54:39 +01:00
Andrew White cbd4bc84af Add comments with urls for email previews 2013-12-22 10:06:12 +00: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
Robin Dupret d39db9da1a Add a changelog entry for #13326 [ci skip] 2013-12-21 14:49:16 +01:00
Kassio Borges 02c814c992 `html` and `text` templates for mailers by default 2013-12-20 18:34:57 -02:00
Pavel Pravosud e1aaa2ff73 Bump Jbuilder version to 2.0.0 2013-12-20 10:35:32 -05:00
Yves Senn 15e442b523 Merge pull request #13415 from schneems/schneems/database-no-username
Do not expect database user with app name to exist
2013-12-19 23:37:48 -08:00
Takayuki Matsubara 15ad57311c Use sass-rails 4.0.1 2013-12-20 12:34:24 +09:00
schneems dece621a21 Do not expect database user with app name to exist
By default when creating a project with `--database=postgresql` the `config/database.yml` file that is generated has a user specified that is the same as the app name

```
development:
  adapter: postgresql
  encoding: unicode
  database: <%= app_name %>_development
  pool: 5
  username: <%= app_name %>
  password:
```

This is counterintuitive and would rarely be valid. By default postgres creates a user with the current user name (http://www.postgresql.org/docs/9.3/static/database-roles.html) "it will have the same name as the operating system user that initialized the database cluster":

```
$ whoami
schneems
```

If the `username` is left out postgresql will assume that you wish to log in as the default user

```
$ psql -c '\du'
                             List of roles
 Role name |                   Attributes                   | Member of
-----------+------------------------------------------------+-----------
 schneems  | Superuser, Create role, Create DB, Replication | {}
```

A good sensible default then for auto generated `database.yml` files is to remove the `username`, and have postgres attempt to connect to the database as the currently logged in user.

Instead of submitting with a blank password, don't submit a password.
2013-12-19 21:41:52 -05:00
Guillermo Iguaran d6ac7d72c5 Merge pull request #13326 from schneems/schneems/add-asset-flag
Flag `config.assets.raise_runtime_errors` in dev
2013-12-19 17:39:53 -08:00
schneems 2ff2f1ba52 Flag `config.assets.raise_runtime_errors` in dev
By default `config.assets.raise_runtime_errors` should be set to `true` in development for new apps.

Source: https://github.com/rails/sprockets-rails/pull/100
2013-12-19 20:37:18 -05:00
schneems 3fa4e1671f Make `rails runner` command options more obvious
We're surrounding the options in angle brackets `<>` as is convention in `curl`:

```
$ curl --help
Usage: curl [options...] <url>
```

And then in square brackets `[]` with bars `|` as in `tar`:

```
$ tar --help
...
Create: tar -c [options] [<file> | <dir> | @<archive> | -C <dir> ]
```

To further clarify that the command can be used with both, we now show examples:

```
Examples:
    rails runner 'puts Rails.env'
        This runs the code `puts Rails.env` after loading the app

    rails runner path/to/filename.rb
        This runs the Ruby file located at `path/to/filename.rb` after loading the app
```

This format was taken from the `find` man pages:

```
EXAMPLES
     The following examples are shown as given to the shell:

     find / \! -name "*.c" -print
             Print out a list of all the files whose names do not end in .c.

     find / -newer ttt -user wnj -print
             Print out a list of all the files owned by user ``wnj'' that are newer than the file ttt.
```

The the text at the bottom is also shifted to improve readability.
2013-12-19 15:43:03 -06:00
Rafael Mendonça França bfdae1775a Make possible to use symbol as the verifier name 2013-12-19 17:06:40 -02:00
Rafael Mendonça França 61f6b47204 Change the message verifier argument to verifier_name 2013-12-19 17:05:22 -02:00
Vijay Dev a3b1105ada Merge branch 'master' of github.com:lifo/docrails 2013-12-20 00:10:30 +05:30
Godfrey Chan e63748cd37 Merge pull request #13366 from vipulnsward/minitest-namespace-change
Change all `MiniTest` to `Minitest`
2013-12-18 19:22:30 -08:00
Xavier Noria 6d894cf3ea make clear that config/secrets.yml passes through ERB and therefore supports ENV 2013-12-18 19:16:32 +01:00
Vipul A M 7bae2921ec Change all `MiniTest` to `Minitest` since, `MiniTest` namespace has been renamed to `Minitest`
Ref: https://github.com/seattlerb/minitest/blob/master/History.txt
2013-12-18 14:39:50 +05:30
David Heinemeier Hansson f706d5f945 Its beta1 all around 2013-12-17 16:10:57 -08:00
David Heinemeier Hansson 98fe2ac902 Remove the navigator for now. Its ugly and it promises more than it can deliver. These other views (properties, routes) are not designed to be loaded in isolation 2013-12-17 15:31:25 -08:00
Guillermo Iguaran 83e4dde41a Add changelog entries about secrets.yml and secrets.secret_key_base 2013-12-17 12:40:13 -05:00
Carlos Antonio da Silva c445c6d1b9 Default I18n.enforce_available_locales to true
We will default this option to true from now on to ensure users properly
handle their list of available locales whenever necessary. This option
was added as a security measure and thus Rails will follow it defaulting
to secure option.

Also improve the handling of I18n config options in its railtie, taking
the new enforce_available_locales option into account, by setting it as
the last one in the process. This ensures no other configuration will
trigger a deprecation warning due to that setting.
2013-12-17 09:05:41 -02:00
Andrew White d6dec7fcb6 Add mailer previews feature based on mail_view gem 2013-12-17 03:58:35 +00:00
Andrew White 1602a70fb4 Add an application controller for internal controllers 2013-12-17 03:58:35 +00:00
Andrew White 9d9f4dac06 Fix method redefinition warning 2013-12-17 03:58:34 +00:00
Yves Senn bd66532ae4 Merge pull request #13328 from teohm/dbconsole_support_database_url
Fixed rails dbconsole to support DATABASE_URL
2013-12-16 02:37:01 -08:00
Huiming Teo 971d5107cd fixed rails dbconsole to support ENV['DATABASE_URL']. 2013-12-16 18:31:49 +08:00
Arthur Neves 2648819ef1 Regression test for load_structure and clone_structure 2013-12-14 18:00:17 -05:00
Guillermo Iguaran eed8c85f4b Merge pull request #13298 from rails/secret_tokens
Create config/secrets.yml file for store of tokens
2013-12-13 09:48:34 -08:00
Guillermo Iguaran c1f4bc2628 Add comment about secret_key_base in secrets.yml 2013-12-13 12:47:37 -05:00
DV Suresh 8ffe2f0d77 Correct comment in databases/postgresql.yml 2013-12-12 21:40:41 -06:00