Commit Graph

3796 Commits

Author SHA1 Message Date
Joshua Peek
8d7fc73e98 Use sprockets-rails branch for now 2012-10-15 10:22:22 -05:00
Joshua Peek
c800e27ad3 Merge branch 'master' into asset-path-helper
Conflicts:
	railties/test/application/configuration_test.rb
2012-10-15 10:20:50 -05:00
Joshua Peek
7dba1599d9 Remove old asset_path from rails config 2012-10-15 09:51:20 -05:00
AvnerCohen
c615161585 Hash syntax to 1.9 style 2012-10-15 00:19:07 +02:00
Robin Dupret
5ad7f8ab41 Use Ruby 1.9 Hash syntax in railties 2012-10-14 18:26:58 +02:00
Jeremy Kemper
1fd8926056 Test that a Rails.queue consumer is automatically started in production 2012-10-13 09:54:34 -07:00
Jeremy Kemper
c8fe0d58bc Backpedal from class-oriented config.queue. Set an actual queue instance. 2012-10-12 22:27:41 -07:00
Jeremy Kemper
775829869e Remove the queue container. Premature consolidation. Set up and maintain queues in the classes that use them instead. 2012-10-12 19:38:40 -07:00
José Valim
32b4d46484 Merge pull request #7891 from schneems/schneems/rake_command_warning
Prompt to run rake when accidentally typed rails
2012-10-12 18:23:50 -07:00
schneems
20385ec6b1 Prompt to run rake when accidentally typed rails
Developers from all levels will accidentally run rake tasks using the `rails` keyword when they meant to use `rake`. Often times beginners struggle with the difference between the tools. The most common example would be `$ rails db:migrate`

Rather than telling the developer simply that they did not use a valid rails command, we can see if it was a valid rake command first. If it is a valid rake command we can auto execute it giving the user a period of time to cancel if that isn't what they intended.

Here is what `rake db:migrate` would look like if you cancel the command:


```sh
$ rails db:migrate
Assuming you meant: $ rake db:migrate 
press any key to cancel in 3 seconds
> 
command terminated ...
```

Here is what it looks like if you don't cancel the command:

```sh
$ rails db:migrate
Assuming you meant: $ rake db:migrate 
press any key to cancel in 3 seconds
> 
Running: $ rake db:migrate 
==  Foo: migrating ============================================================
==  Foo: migrated (0.0000s) ===================================================
```
2012-10-12 13:08:10 -10:00
Brent J. Nordquist
06129c0e3f Add .rake to rake notes and rake notes:custom 2012-10-12 10:52:22 -05:00
Jeremy Kemper
79db8db415 Immediately run queued jobs in tests. Otherwise you have to explicitly drain the queue to actually deliver your emails. 2012-10-12 07:49:44 -07:00
Vijay Dev
e40f515a75 Fixing build failures
Build failed with an error "invalid multibyte char (US-ASCII)" in these
files. Apparently, some UTF-8 char disguised as whitespace causes this.

Thanks @rafaelfranca
2012-10-11 02:05:25 +05:30
Vijay Dev
2441160c05 Merge pull request #7898 from olivierlacan/pg_homebrew_instructions
Offer instructions for pg gem when installed via Homebrew
2012-10-10 12:45:36 -07:00
Vijay Dev
f638ef951b Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	activerecord/lib/active_record/persistence.rb
	railties/lib/rails/generators/rails/resource_route/resource_route_generator.rb
2012-10-11 01:05:14 +05:30
Vijay Dev
3401d5089b fix github url [ci skip] 2012-10-11 01:02:41 +05:30
Vijay Dev
6754777adf copy-edit the email delivery errors comment 2012-10-11 00:59:29 +05:30
David Heinemeier Hansson
affd05d28b Merge branch 'master' of github.com:rails/rails 2012-10-10 19:21:11 +02:00
Olivier Lacan
58d69a536c Offer instructions for pg gem when installed via Homebrew 2012-10-10 11:02:32 -04:00
Mike Moore
2a68f68aea Update test locations
Change the default test locations to avoid confusion around the common
testing terms "unit" and "functional".
Add new rake tasks for the new locations, while maintaining backwards
compatibility with the old rake tasks.

New testing locations are as follows:

    app/models -> test/models (was test/units)
    app/helpers -> test/helpers (was test/units/helpers)
    app/controllers -> test/controllers (was test/functional)
    app/mailers -> test/mailers (was test/functional)
2012-10-09 17:53:56 -06:00
Guillermo Iguaran
fbfea9e98d Rails.config doesn't exist, it should be Rails.application.config instead 2012-10-09 11:17:22 -05:00
claudiob
44592334d5 Remove duplicate 'the' article in commented line
The sentence used to read "at the bottom of the the compiled file"
2012-10-08 14:00:59 -07:00
David Heinemeier Hansson
43e14f8ff2 Merge pull request #7873 from steveklabnik/update_initializer
Moving locale stuff from app.rb to an initializer.
2012-10-08 09:08:27 -07:00
David Heinemeier Hansson
1fc7954685 There is already an invitation to use rack-cache in config/environments/production.rb 2012-10-08 18:06:54 +02:00
Steve Klabnik
185c020996 Moving locale stuff from app.rb to an initializer. 2012-10-08 09:06:03 -07:00
David Heinemeier Hansson
bb17a0f085 Cleanup comments a bit and fuck 80 characters 2012-10-08 18:03:17 +02:00
David Heinemeier Hansson
9e8452029c Inline comment 2012-10-08 17:57:28 +02:00
David Heinemeier Hansson
daf5b66a11 Encoding already defaults to utf-8 per lib/rails/application/configuration.rb:23 2012-10-08 17:52:07 +02:00
David Heinemeier Hansson
fc7f3daeb6 Everyone is running bundler, no need for defensive programming shit 2012-10-08 17:49:46 +02:00
David Heinemeier Hansson
d81e76ddd6 Not precompiling your assets for production is a bad idea -- do not encourage it 2012-10-08 17:44:51 +02:00
Francesco Rodriguez
521e2eeac9 update Rails::Generators docs [ci skip] 2012-10-07 15:36:39 -05:00
Francesco Rodriguez
2f1eea8067 nodoc JS::Generators [ci skip] 2012-10-07 13:50:31 -05:00
Francesco Rodriguez
0ee5433ae6 nodoc Erb::Generators [ci skip] 2012-10-07 13:49:46 -05:00
Francesco Rodriguez
4e8ce2c528 nodoc CSS::Generators [ci skip] 2012-10-07 13:47:34 -05:00
Francesco Rodriguez
eecf14db66 nodoc TestUnit::Generators [ci skip] 2012-10-07 13:41:53 -05:00
Alexey Muranov
a94220b66c Rename "Fixtures" class to "FixtureSet"
Rename `ActiveRecord::Fixtures` class to `ActiveRecord::FixtureSet`.  Instances of this class normally hold a collection of fixtures (records) loaded either from a single YAML file, or from a file and a folder with the same name.  This change make the class name singular and makes the class easier to distinguish from the modules like `ActiveRecord::TestFixtures`, which operates on multiple fixture sets, or `DelegatingFixtures`, `::Fixtures`, etc., and from the class `ActiveRecord::Fixture`, which corresponds to a single fixture.
2012-10-07 19:15:58 +02:00
Jeremy Kemper
d073116455 Gotta log each spacer line separately to ensure each is tagged 2012-10-06 22:16:39 -07:00
Jeremy Kemper
1a7049906e Tag the blank log line between dev requests so it's easier to filter out entire requests with grep -v without leaving a stray newline behind. Example:
# Tag asset requests so it's easy to filter them from dev logs
  config.log_tags = [
    -> request { :assets if request.path.starts_with?(config.assets.prefix) },
    -> request { request.uuid }
  ]

  # Watch the logs, ignoring asset requests
  $ tail -100f log/development.log | grep -v assets
2012-10-06 22:10:14 -07:00
Rafael Mendonça França
f89ef12eb6 Remove unneeded attr_reader 2012-10-07 02:07:16 -03:00
Adrien Lamothe
777ffc3d66 Update railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt 2012-10-06 13:41:44 -07:00
Francesco Rodriguez
d91bee80be use Rails backtrace in tests 2012-10-05 21:42:11 -05:00
Santiago Pastorino
a0613ad8a9 Revert "Use flat_map { } instead of map {}.flatten"
This reverts commit abf8de85519141496a6773310964ec03f6106f3f.
We should take a deeper look to those cases flat_map doesn't do deep
flattening.

irb(main):002:0> [[[1,3], [1,2]]].map{|i| i}.flatten
=> [1, 3, 1, 2]
irb(main):003:0> [[[1,3], [1,2]]].flat_map{|i| i}
=> [[1, 3], [1, 2]]
2012-10-05 12:07:16 -03:00
Santiago Pastorino
abf8de8551 Use flat_map { } instead of map {}.flatten 2012-10-05 11:52:20 -03:00
Guillermo Iguaran
3a68a53e17 Comment rack-cache entry on Gemfile 2012-10-04 21:53:07 -05:00
Guillermo Iguaran
586a991830 config.action_dispatch.rack_cache should set explicitly to enable Rack::Cache 2012-10-04 21:36:00 -05:00
Rafael Mendonça França
98c372b80b Strip heredoc to not generate the Gemfile with trailing spaces 2012-10-04 18:17:02 -03:00
David Heinemeier Hansson
e35d8b18d0 Turn turbolinks on by default for new apps 2012-10-04 20:22:42 +02:00
Prem Sichanugrist
26fe77b27d Make Rails.public_path return a Pathname 2012-10-02 20:44:02 -04:00
Michael Koziarski
0a507925cf Merge pull request #6952 from NZKoz/key_generator
Add ActiveSupport::KeyGenerator as a simple wrapper around PBKDF2
2012-10-02 14:26:16 -07:00
Santiago Pastorino
037e50ec39 Merge pull request #7794 from guilleiguaran/extract-rack-cache
Use Rack::Cache middleware only if is in Gemfile
2012-10-01 19:52:52 -07:00
Guillermo Iguaran
f4a6f1d3f0 Add rack-cache to default Gemfile 2012-10-01 21:51:39 -05:00
Guillermo Iguaran
cbd26a803b Use Rack::Cache middleware only if is in Gemfile 2012-10-01 21:38:52 -05:00
Michael Koziarski
0479bff32d Provide access to the application's KeyGenerator
Available both as an env entry for rack and an instance method on Rails::Application for other uses
2012-10-01 15:34:12 +13:00
Jeremy Walker
a3117335cc Fixed generated whitespace in routes when using namespaced resource. 2012-09-29 16:39:27 +01:00
Guillermo Iguaran
a4c358f84c Assets cache shouldn't be shared between different environments 2012-09-28 15:20:17 -05:00
Jeremy Kemper
c131211c67 Tune up Rails::Rack::Logger. Only put space between requests in development logs. 2012-09-26 15:19:34 -07:00
Jeremy Kemper
d1cbcd781b Log newlines separately to ensure the 'Started GET ...' line has a tag on the same line 2012-09-25 20:27:26 -07:00
Jeremy Kemper
152e3ac3d2 Only apply log tags if the logger supports it 2012-09-24 14:07:10 -07:00
Geoffrey Roguelon
ee3e2c256f Remove of an extra line in template configuration file. 2012-09-24 11:11:37 +02:00
Brian Morearty
263764d13a Removed sorting of attribute names in controller generator.
I believe when people use generators, they typically order the
parameters on the command line in an order that makes sense
to them.  Sorting them in the generated code  makes the order
seem more arbitrary to humans, even though it's less arbitrary
to computers. :-)

Example:

    rails g scaffold Post title:string content:text

The human chose to put title before content. Sorted
attributes in the generated code work but don't match the
human's intent:

    params.require(:posts).permit(:content, :title)
2012-09-23 08:19:02 -07:00
Vijay Dev
3b7947ea31 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	actionmailer/lib/action_mailer/base.rb
	activesupport/lib/active_support/configurable.rb
	activesupport/lib/active_support/core_ext/module/deprecation.rb
	guides/source/action_controller_overview.md
	guides/source/active_support_core_extensions.md
	guides/source/ajax_on_rails.textile
	guides/source/association_basics.textile
	guides/source/upgrading_ruby_on_rails.md

While resolving conflicts, I have chosen to ignore changes done in
docrails at some places - these will be most likely 1.9 hash syntax
changes.
2012-09-21 22:49:20 +05:30
Stephan Hagemann
c15e4235f0 Updated description of what engines are used for 2012-09-21 10:57:15 -06:00
Guillermo Iguaran
66ed71fd6f Remove highly uncommon config.assets.manifest option for moving the manifest path.
This option is now unsupported in sprockets-rails.
2012-09-19 18:02:37 -05:00
David Heinemeier Hansson
c49d959e9d Merge pull request #7251 from rails/integrate-strong_parameters
Integrate strong_parameters in Rails 4
2012-09-18 12:33:13 -07:00
Rafael Mendonça França
5428de1efd Merge pull request #5339 from gregolsen/week_start_config
week_start option added to rails app config
2012-09-18 08:00:45 -07:00
gregolsen
da26dfbefd Date.beginning_of_week thread local and beginning_of_week application config option added (default is Monday) 2012-09-18 17:18:19 +03:00
Steve Klabnik
88d578a11f Remove 'assigned but unused variable' warning 2012-09-18 16:53:36 +03:00
Arun Agrawal
3e4458b73b Fix build for Queue. 2012-09-17 12:13:15 +05:30
Guillermo Iguaran
978c568a7b Change scaffold_generator: Don't use #require or #permit in scaffold if attributes list isn't given 2012-09-16 23:58:21 -05:00
Guillermo Iguaran
8042835c15 Change scaffold_controller to generate and use private method to encapsulate permissible params 2012-09-16 23:58:20 -05:00
Guillermo Iguaran
d695fdbd11 Remove all references to attr_accessible/protected and old mass_assignment_sanitizers 2012-09-16 23:58:20 -05:00
David Czarnecki
75b9c2c236 Clarify the documentation on the Rails::Application#call method 2012-09-15 11:11:54 -04:00
Santiago Pastorino
8577687fcb Move queue classes to ActiveSupport 2012-09-14 14:10:00 -07:00
Michael Koziarski
bb732beba7 Merge pull request #7616 from lest/null-session-forgery-protection
Implement :null_session CSRF protection method
2012-09-13 20:44:45 -07:00
Uģis Ozols
b47d5bb77e Remove redundant 'the'. 2012-09-13 21:36:26 +03:00
Sergey Nartimov
95be790ece Implement :null_session CSRF protection method
It's further work on CSRF after 245941101b1ea00a9b1af613c20b0ee994a43946.

The :null_session CSRF protection method provide an empty session during
request processing but doesn't reset it completely (as :reset_session
does).
2012-09-13 12:07:37 +03:00
Derek Prior
ceb05bd1b2 change app/plugin generators to be more SCM agnostic
Users of other SCM's can now generate rails
apps that will add the "empty" directories to source control,
but will not have a useless .gitignore or mis-named .gitkeep
files.

* Change `rails new` and `rails plugin new` generators to name
  the `.gitkeep` as `.keep` in a more SCM-agnostic way.

* Change `--skip-git` option to only skip the `.gitignore` file
  and still generate the `.keep` files.

* Add `--skip-keeps` option to skip the `.keep` files.

It closes #2800.
2012-09-12 20:36:00 -05:00
Rafael Mendonça França
85d8b22a71 Remove the queue configuration from the environments templates since the
default is the SynchronousQueue.
2012-09-12 15:54:06 -03:00
Rafael Mendonça França
9bb4850e7b Use the SynchronousQueue as default in production and development.
We should not let the users use the ThreadedConsumer without know about
the risks
2012-09-12 15:19:34 -03:00
Santiago Pastorino
34b23e7110 Action Mailer async flag is true by default using a Synchronous impl 2012-09-11 15:11:52 -07:00
needfeed
844ea9c07e Support MySQL SSL in rails dbconsole. 2012-09-10 12:36:49 -07:00
Xavier Noria
7f800b4d69 require bundle in the app generator
The app generator is not generally run under bundler, but the Bundler
constant is used here.

In particular you cannot create --dev apps without this.
2012-09-01 20:09:49 +02:00
Piotr Sarnacki
7fc4b4681b Use Bundler.with_clean_env instead of custom code 2012-08-31 20:51:37 +02:00
Piotr Sarnacki
414158805f Revert "Revert changes related to bundle install fixes in rails new"
The cause of the previous revert was bug in bundler that made it hard to
make railties test work. Fix for bundler was recently pushed to github,
so now we can safely get back to the original commit.

This reverts commit 0f5cc34ab58cda99d1401ecc82e1ebb873838dd7.
2012-08-31 20:51:37 +02:00
Philipp Weissensteiner
8102c0d9ed Change generators controller help from singular to plural example.
When running `rails generate controller --help` an example
with creating a (singular) "CreditCard" controller is
shown. The convention is to generate controllers with plural
names though.
2012-08-28 14:01:20 +02:00
Prem Sichanugrist
1807384c96 Raise more helpful error message on missing gem
Tell people to install `activerecord-session_store` gem when it's not
installed instead ofraising `NameError` on missing
`ActionDispatch::Session::ActiveRecordStore`.
2012-08-24 17:05:14 -04:00
Prem Sichanugrist
19a3eda011 Remove meta Sesion Migration generator 2012-08-24 16:03:15 -04:00
Prem Sichanugrist
0ffe19056c Extract ActiveRecord::SessionStore from Rails
This functionality will be available from gem
`active_record-session_store` instead.
2012-08-24 15:24:19 -04:00
José Valim
e8eb68c19a Fix failure on middleware/exceptions_test
The reason the test was failing was because when the test
invokes `app.config`, the app is loaded and, as `eager_load`
is set to true, it disables the dependency loading mechanism,
so controllers that are later defined are not loaded.
2012-08-23 10:24:19 -03:00
Rafael Mendonça França
16fbe6f3e3 Update the ducumentation about the before_eager_load callback [ci skip] 2012-08-22 22:12:24 -03:00
Vijay Dev
79e880f7f4 edit secret token template comment [ci skip] 2012-08-23 01:07:35 +05:30
Teng Siong Ong
0d809f6129 remind user a good way to generate a secret code. 2012-08-21 20:37:58 -07:00
José Valim
6bef1469d2 Merge pull request #7225 from rails/eager_load
Improve eager load on Rails
2012-08-21 12:58:25 -07:00
Carlos Antonio da Silva
11e890fef8 Merge pull request #6499 from lazylester/patch-1
Clarify and correct the description for the --full option of the 
plugin_new generator. [ci skip]
2012-08-21 12:35:30 -07:00
lazylester
7f765da7a7 Clarify and correct the description for the --full option of the plugin_new generator 2012-08-21 12:22:21 -07:00
Aaron Patterson
da3d28ea33 add Rack::Lock for webrick 2012-08-21 14:47:43 -03:00
José Valim
5d416b9078 Deprecate config.threadsafe! 2012-08-21 14:47:43 -03:00
José Valim
2801786e1a Get rid of config.preload_frameworks in favor of config.eager_load_namespaces
The new option allows any Ruby namespace to be registered and set
up for eager load. We are effectively exposing the structure existing
in Rails since v3.0 for all developers in order to make their applications
thread-safe and CoW friendly.
2012-08-21 14:47:19 -03:00
José Valim
11bc3487ab Remove allow_concurrency as a flag
The flag was mainly used to add a Rack::Lock middleware to
the stack, but the only scenario the lock is desired is in
development.

If you are deploying on a not-threaded server, the Rack::Lock
does not provide any benefit since you don't have concurrent
accesses. On the other hand, if you are on a threaded server,
you don't want the lock, since it defeats the purpose of using
a threaded server.

If there is someone out there, running on a thread server
and does want a lock, it can be added to your environment
as easy as: `use Rack::Lock`
2012-08-21 14:46:12 -03:00
José Valim
e6747d87f3 Allow users to choose when to eager_load the application or not.
Previously, the eager load behavior was mostly coupled to
config.cache_classes, however this was suboptimal since in
some environments a developer may want to cache classes but
not necessarily load them all on boot (for example, test env).

This pull request also promotes the use of config.eager_load
set to true by default in production. In the majority of the
cases, this is the behavior you want since it will copy most
of your app into memory on boot (which was also the previous
behavior).

Finally, this fix a long standing Rails bug where it was
impossible to access a model in a rake task when Rails was
set as thread safe.
2012-08-21 14:46:12 -03:00