Commit Graph

10698 Commits

Author SHA1 Message Date
Rafael Mendonça França
ff044c3c3a Use thor class_option to make the primary_key_type option work
Also move the method to the right class
2015-10-23 21:34:07 -02:00
Jon McCartie
f0323288da Move default uuid generation to active_record 2015-10-23 21:34:00 -02:00
yuuji.yaginuma
65590e3c96 remove unnecessary readme in dummy application
`README` it is changed to `README.rdoc` in 6b126e2, it has been changed to` README.md` further 89a12c9.
2015-10-23 19:41:56 +09:00
Rafael Mendonça França
6080bfcfbe config.generators should be docummented since it is public API
[ci skip]
2015-10-22 14:52:19 -02:00
Sean Griffin
ff76465131 Revert " Added an example to show how common secrets can be shared across multiple environments in secrets.yml" 2015-10-20 17:27:06 -06:00
Sean Griffin
6ae515d1bf Merge pull request #19898 from prathamesh-sonpatki/common-secrets
Added an example to show how common secrets can be shared across multiple environments in secrets.yml [ci skip]
2015-10-20 17:00:47 -06:00
Jon McCartie
fb42c492a7 Set active_record config for always creating uuids in generators 2015-10-20 14:25:06 -07:00
Sean Griffin
9be4ea8184 Merge pull request #21978 from ctreatma/console_helper_reload
Fix #21977: Removes memoization of helpers in Rails console
2015-10-19 19:41:15 -06:00
yuuji.yaginuma
93d99c55bd remove useless method
`images` method has been deleted in 2bc4856, `create_images_directory` does nothing.
2015-10-18 15:41:07 +09:00
Marat Galiev
706850a443 Use "rake time:zones:all" instead of "rake -D time" [ci skip] 2015-10-17 09:17:42 +03:00
Charles Treatman
fa65b44b28 Fix #21977: Removes memoization of helpers in Rails console
In the Rails console, the `helper` function provides a shorthand for
working with application helpers.  However, `helper` memoizes the
value of `ApplicationController#helpers`. This means that if a user
subsequently changes helper code and calls `reload!` in the console,
their code changes will not be reflected by the `helper` function,
even though the helper was, in fact, reloaded.
2015-10-16 19:28:38 -04:00
Arthur Nogueira Neves
3ad381c3f8 Merge pull request #21961 from Gaurav2728/migration_class_methods_nodoc
migrations Class methods have nodoc, fix it for API [ci skip]
2015-10-14 14:18:23 -04:00
Gaurav Sharma
d68514c168 migrations Class methods have nodoc, fix it for API [ci skip] 2015-10-14 23:44:12 +05:30
Arthur Nogueira Neves
2145701cdd Merge pull request #20908 from y-yagi/generate_application_job_inside_engine
add application_job.rb to template of mountable engine
2015-10-13 21:47:29 -04:00
Jeremy Daer
9d05430c95 Merge pull request #19135 from yuki24/access-control-support
Add basic support for access control headers to ActionDispatch::Static
2015-10-13 11:16:50 -07:00
Arthur Nogueira Neves
9674703671 Merge pull request #17388 from akampjes/master
ActionMailer https on URL with force_ssl = true
2015-10-12 14:26:11 -04:00
yuuji.yaginuma
12248b885c do not generate manifest.js in plugins
Since the plugin generator do not generate assets, I think manifest.js also that it unnecessary.
2015-10-12 14:47:40 +09:00
Sean Griffin
64476e9194 Merge pull request #21912 from y-yagi/move_prepare_destination_to_public
change `prepare_destination` to public API [ci skip]
2015-10-08 18:03:24 -06:00
yuuji.yaginuma
9b4ec029f6 remove unused require
`shellwords` is no longer needed from #20605.
2015-10-08 21:12:07 +09:00
yuuji.yaginuma
46784703e2 change prepare_destination to public API [ci skip]
`prepare_destination` has been used in the template file for the generator,
I think it should be a public API

ref: https://github.com/rails/rails/blob/master/railties/lib/rails/generators/test_unit/generator/templates/generator_test.rb#L8
2015-10-08 17:57:58 +09:00
Andrew White
fef1064052 Merge pull request #21804 from merhard/mounted_engine_route_fix
Mounted engine route fix
2015-10-07 22:25:39 +01:00
Kasper Timm Hansen
54f3a18eec Output inline is set to true in the plugin.
Change the reporter to just read the option.

Pass output_inline where needed in tests.
2015-10-07 22:49:41 +02:00
Kasper Timm Hansen
11a3e02237 Refactor create_test_file to take a pass option.
Lets us cut the verbose and straight up duplicated setup in 3 tests down to one line.
2015-10-07 22:49:41 +02:00
Kasper Timm Hansen
da832016bf Hide Minitest's aggregated results if outputting inline.
We'd see the failures and errors reported after the run, which is needless, when we've already
reported them.

Turns:

```

.......................................S....................F

This failed

bin/rails test test/models/bunny_test.rb:14

....

Finished in 0.100886s, 1020.9583 runs/s, 1001.1338 assertions/s.

  2) Failure:
BunnyTest#test_something_failing [/Users/kasperhansen/Documents/code/collection_caching_test/test/models/bunny_test.rb:15]:
This failed

103 runs, 101 assertions, 1 failures, 0 errors, 1 skips

You have skipped tests. Run with --verbose for details.
```

Into:

```

...................S.......................................F

This failed

bin/rails test test/models/bunny_test.rb:14

......................

Finished in 0.069910s, 1473.3225 runs/s, 1444.7143 assertions/s.

103 runs, 101 assertions, 1 failures, 0 errors, 1 skips
```
2015-10-07 22:49:41 +02:00
Matthew Erhard
bcfbd8ba21 Fix mounted engine named routes regression
When generating the url for a mounted engine through its proxy, the path should be the sum of three parts:

1. Any `SCRIPT_NAME` request header or the value of `ActionDispatch::Routing::RouteSet#relative_url_root`.
2. A prefix (the engine's mounted path).
3. The path of the named route inside the engine.

Since commit 44ff0313c1, this has been broken. Step 2 has been changed to:

2. A prefix (the value of `ActionDispatch::Routing::RouteSet#relative_url_root` + the engine's mounted path).

The value of `ActionDispatch::Routing::RouteSet#relative_url_root` is taken into account in step 1 of the route generation and should be ignored when generating the mounted engine's prefix in step 2.

This commit fixes the regression by having `ActionDispatch::Routing::RouteSet#url_for` check `options[:relative_url_root]` before falling back to `ActionDispatch::Routing::RouteSet#relative_url_root`. The prefix generating code then sets `options[:relative_url_root]` to an empty string. This empty string is used instead of `ActionDispatch::Routing::RouteSet#relative_url_root` and avoids the duplicate `relative_url_root` value in the final result.

This resolves #20920 and resolves #21459
2015-10-07 12:45:01 -04:00
James Kerr
279d0ae816 Update the URL when changing mailer preview formats
Added javascript to update the URL on mailer previews with the
currently selected email format. Reloading the page now keeps you on
your selected format rather than going back to the default html version.
2015-10-06 13:32:07 -07:00
Jeremy Daer
565094a8b5 Use Mime[:foo] instead of Mime::Type[:FOO] for back compat
Rails 4.x and earlier didn't support `Mime::Type[:FOO]`, so libraries
that support multiple Rails versions would've had to feature-detect
whether to use `Mime::Type[:FOO]` or `Mime::FOO`.

`Mime[:foo]` has been around for ages to look up registered MIME types
by symbol / extension, though, so libraries and plugins can safely
switch to that without breaking backward- or forward-compatibility.

Note: `Mime::ALL` isn't a real MIME type and isn't registered for lookup
by type or extension, so it's not available as `Mime[:all]`. We use it
internally as a wildcard for `respond_to` negotiation. If you use this
internal constant, continue to reference it with `Mime::ALL`.

Ref. efc6dd550ee49e7e443f9d72785caa0f240def53
2015-10-06 11:29:30 -07:00
Arthur Nogueira Neves
280c09a210 Merge pull request #20986 from radar/rails-engine-caller-locations
Remove check for caller_locations in Rails::Engine
2015-10-04 20:46:54 -04:00
Vijay Dev
7976b6d306 Merge branch 'master' of github.com:rails/docrails 2015-10-04 12:33:14 +00:00
Aaron Patterson
24f9c03d52 Revert "removing Rack::Runtime from the default stack."
This reverts commit 37423e4ff883ad5584bab983aceb4b2b759a1fd8.

Jeremy is right that we shouldn't remove this.  The fact is that many
engines are depending on this middleware to be in the default stack.
This ties our hands and forces us to keep the middleware in the stack so
that engines will work.  To be extremely clear, I think this is another
smell of "the rack stack" that we have in place.  When manipulating
middleware, we should have meaningful names for places in the req / res
lifecycle **not** have engines depend on a particular constant be in a
particular place in the stack.  This is a weakness of the API that we
have to figure out a way to address before removing the constant.

As far as timing attacks are concerned, we can reduce the granularity
such that it isn't useful information for hackers, but is still useful
for developers.
2015-10-03 14:21:31 -07:00
Kasper Timm Hansen
1b00c36d85 Merge pull request #21851 from y-yagi/use_class_to_specify_middleware
use class to specify the middleware [ci skip]
2015-10-03 12:57:09 +02:00
yuuji.yaginuma
70b09eda03 use class to specify the middleware [ci skip]
using string for middleware class names is deprecated in 83b767cef90abfc4c2ee9f4b451b0215501fae9a
2015-10-03 19:26:24 +09:00
Aaron Patterson
37423e4ff8 removing Rack::Runtime from the default stack.
The runtime header is a potential target for timing attacks since it
returns the amount of time spent on the server (eliminating network
speed).  Total time is also not accurate for streaming responses.

The middleware can be added back via:

```ruby
config.middleware.ues ::Rack::Runtime
```
2015-10-02 14:45:31 -07:00
Roque Pinel
e2b3ccd1aa Refactor AS::Callbacks halt config and fix the documentation
Move from `AS::Callbacks::CallbackChain.halt_and_display_warning_on_return_false`
to `AS::Callbacks.halt_and_display_warning_on_return_false` base on
[this
discussion](https://github.com/rails/rails/pull/21218#discussion_r39354580)

Fix the documentation broken by 0a120a818d413c64ff9867125f0b03788fc306f8
2015-10-01 13:04:20 -04:00
Aaron Patterson
8f8b7ae1d8 only construct one request in an engine 2015-09-30 11:23:00 -07:00
Aaron Patterson
ff30db1372 run against edge sass to eliminate circular require warnings 2015-09-30 07:42:58 -07:00
Aaron Patterson
ea3908535a call default_middleware_stack before merging stacks
`default_middleware_stack` seems to kick off the `on_load` calls that
may mutate the middleware stack.  We have to call that method before
merging middleware stacks, otherwise the middleware stacks get mutated
*after* the app middleware stack is built.
2015-09-29 14:36:32 -07:00
Aaron Patterson
42070f892b Engines get different middleware than apps
We shouldn't merge the app middleware in to the config middleware for
engines.
2015-09-29 13:35:13 -07:00
Jeremy Daer
bb25c671c8 Merge pull request #21794 from jeremy/sprockets/move-asset-manifest-from-toplevel-to-config-subdir
Eliminate overlapping `app/assets` load path
2015-09-29 13:22:56 -07:00
Jeremy Daer
20ec1e922c Eliminate overlapping app/assets load path
* Move `app/assets/manifest.js` to `app/assets/config/manifest.js`.
  Avoid the suggestion that you can/should deep-link `stylesheets/foo`.
* Pull in all toplevel stylesheets and JavaScripts, not just
  `application.js` and `.css`. Demonstrate how to use `link_directory`
  with a specified `.js`/`.css` type.
* Fix RAILS_ENV handling in assets tests.
* Shush warnings spam from third-party libs that distract from tests.
2015-09-29 11:56:58 -07:00
eileencodes
3a512162be Make app building threadsafe 2015-09-29 14:10:05 -04:00
eileencodes
d951558f78 Stop modifying global variables
Allocating a new middleware proxy in each application configuration and
then merging the app specific config with the global config when the app
is built.
2015-09-29 14:03:09 -04:00
Kasper Timm Hansen
2310fb9d81 Add fail fast to test runner.
Passing `--fail-fast` to the test runner will now abort the test run
on the first failure. The run continues on any unexpected errors.
2015-09-29 08:37:33 +02:00
Kasper Timm Hansen
64a3b09b40 Add inline failure reporting to test runner.
Any failures or errors will be reported inline during the run by default.
Skipped tests will be reported if run in verbose mode.

Any result is output with failure messages and a rerun snippet for that test.

Rerun snippets won't be output after a run, unless `--defer-output` is passed.
2015-09-28 20:30:03 +02:00
Ronak Jangir
dd5b083f5d Renamed ‘Return’ to ‘Returns’ [ci skip] 2015-09-28 20:15:53 +05:30
Kasper Timm Hansen
805bd7a81a Merge pull request #21789 from y-yagi/fix_warning_in_minitest_plugin
check if @rake_patterns is defined
2015-09-28 09:21:39 +02:00
yuuji.yaginuma
cc7867da4a check if @rake_patterns is defined
This removes the following warning.
```
railties/lib/rails/test_unit/minitest_plugin.rb:45: warning: instance variable @rake_patterns not initialize
```
2015-09-28 13:30:32 +09:00
eileencodes
0ce3b97fa3 Fix test that was failing because of typo
Here `app` needed to be `get` because we're getting a route. This fixes
the typo so the test passes.
2015-09-27 11:39:32 -04:00
Aditya Kapoor
b5e82d99ef Add missing routing tests for info controller
Vaguely related to #21605 where I proposed to remove index route since it was redirecting to the 'routes' action,

but this was kept so I thought it made sense to add some tests regarding this.
2015-09-27 12:49:20 +05:30
amitkumarsuroliya
563020d8a1 Fix typo in configuration test descritive > descriptive [ci skip] 2015-09-26 18:10:07 +05:30