Commit Graph

4969 Commits

Author SHA1 Message Date
Piotr Sarnacki
79bd92b783 Refactor ActionMailer to not use hide_actions 2010-09-03 22:59:11 +02:00
Piotr Sarnacki
4131a2d804 Move ActionController::Railties::RoutesHelpers and ActionMailer::Railties::RoutesHelper to AbstractController::Railties::RoutesHelpers 2010-09-03 22:59:11 +02:00
Piotr Sarnacki
befa77fc18 Fix generating urls with mounted helpers in view context
There were actually 2 problems with this one:
* script_name was added to options as a string and then it was used
  in RouteSet#url_for with usage of <<, which was changing the original
  script_name
* the second issue was with _with_routes method. It was called in RoutesProxy
  to modify _routes in view_context, but url_helpers in views is just delegating
  it to controller, so another _with_routes call is needed there
2010-09-03 22:59:10 +02:00
Piotr Sarnacki
c7664d112f Include application's helpers and router helpers by default, but include engine's ones for controllers inside isolated namespace 2010-09-03 22:59:10 +02:00
Piotr Sarnacki
9913193931 For view_context we need to initialize RoutesProxy in context of controller, not view, quick fix, I need to dig into it later 2010-09-03 22:59:10 +02:00
Piotr Sarnacki
2734d3819f This is not needed 2010-09-03 22:59:10 +02:00
Piotr Sarnacki
401cd97923 Modified ActionDispatch::Static to allow passing multiple roots 2010-09-03 22:59:09 +02:00
Piotr Sarnacki
bfccbc6df9 Add Rails::Railtie.railtie_name method to allow setting custom name for railtie 2010-09-03 22:59:08 +02:00
Piotr Sarnacki
4cd6f77526 We don't need delegating polymorphic_url and polymorphic_path anymore 2010-09-03 22:59:08 +02:00
Piotr Sarnacki
a132229d7b Added ability to set asset_path for engines 2010-09-03 22:59:08 +02:00
Piotr Sarnacki
6c95e0f879 Add mounted_helpers to routes
mounted_helpers are a bit similar to url_helpers. They're automatically
included in controllers for Rails.application and each of mounted
Engines. Mounted helper allows to call url_for and named helpers for
given application.

Given Blog::Engine mounted as blog_engine, there are 2 helpers defined:
app and blog_engine. You can call routes for app and engine using those
helpers:

app.root_url
app.url_for(:controller => "foo")
blog_engine.posts_path
blog_engine.url_for(@post)
2010-09-03 22:59:07 +02:00
Piotr Sarnacki
e9791bec82 Routes refactoring:
* added more tests for prefix generation
* fixed bug with generating host for both prefix and url
* refactored url_for method
* organized tests for prefix generation
2010-09-03 22:59:07 +02:00
Piotr Sarnacki
233be6572c Ensure that env is always available in controllers 2010-09-03 22:59:06 +02:00
Piotr Sarnacki
b53efd2105 Extended url_for to handle specifying which router should be used.
A few examples:
url_for Blog::Engine, :posts_path
url_for Blog::Engine, @post
url_for Blog::Engine, :action => "main", :controller => "index"
2010-09-03 22:59:06 +02:00
Piotr Sarnacki
b697ba9fd7 Added some more tests for url generation between Engine and Application 2010-09-03 22:59:06 +02:00
Piotr Sarnacki
8a077089d9 Get rid of :skip_prefix options in routes 2010-09-03 22:59:06 +02:00
Piotr Sarnacki
eedbf87d15 New way of generating urls for Application from Engine.
It's based specifying application's script_name with:
Rails.application.default_url_options = {:script_name => "/foo"}

default_url_options method is delegated to routes. If router
used to generate url differs from the router passed via env
it always overwrites :script_name with this value.
2010-09-03 22:59:05 +02:00
Piotr Sarnacki
451c9942bb Allow to generate Application routes inside Engine
This requires knowledge about original SCRIPT_NAME and
the parent router. It should be pass through the env
as ORIGIAL_SCRIPT_NAME and action_dispatch.parent_routes
2010-09-03 22:59:05 +02:00
Piotr Sarnacki
28016d33b0 Use env['action_dispatch.routes'] to determine if we should generate prefix or not.
This technique is here to allow using routes from Engine in Application
and vice versa. When using Engine routes inside Application it should
generate prefix based on mount point. When using Engine routes inside
Engine it should use env['SCRIPT_NAME']. In any other case it should
generate prefix as env should not be even available.
2010-09-03 22:59:05 +02:00
Piotr Sarnacki
f7af75976a require 'active_support/dependencies' in action_dispatch/middleware/stack 2010-09-03 22:59:03 +02:00
Xavier Noria
93acbf6bf3 Merge remote branch 'docrails/master' 2010-09-03 21:30:22 +02:00
José Valim
599e46bf24 Revert "Setup explicit requires for files with exceptions. Removed them from autoloading."
Booting a new Rails application does not work after this commit [#5359 state:open]

This reverts commit 38a421b34d.
2010-09-02 21:11:03 +02:00
José Valim
48bf667a8b Ensure routes are loaded only after the initialization process finishes, ensuring all configuration options were applied. 2010-09-02 12:54:21 +02:00
Łukasz Strzałkowski
38a421b34d Setup explicit requires for files with exceptions. Removed them from autoloading.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 11:54:04 +02:00
Łukasz Strzałkowski
c5c839f75f Cleaned up autoload definitions.
Now it's more transparent, and readable

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 11:53:58 +02:00
Thiago Pradi
df7f441c6e Removing RJS hack
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 11:51:07 +02:00
Andrew White
02480a897b Move implicit nested call before options handling so that nested constraints work [#5513 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-01 10:09:14 +02:00
Alex Chrome
dbf82557e4 Added :format option for form_for helper and spec for this [#5226 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-01 09:59:54 +02:00
yury
9a6e3ae763 Remove unnecessary code from UrlHelper#link_to.
convert_options_to_data_attributes always returns not nil stringified html_options [#5445 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-01 09:57:04 +02:00
Thiago Pradi
46c14a6b03 Use join instead of looping and calling to_s [#5492 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-01 09:46:30 +02:00
Akira Matsuda
37e0c153de fix typo(?) 2010-09-01 16:00:55 +09:00
Xavier Noria
8b2e4fddbf Merge remote branch 'docrails/master' 2010-09-01 00:01:26 +02:00
wycats
58d3b90423 Speed up form_for by specializing extract_options! (at asakusa.rb) 2010-08-31 20:33:28 +09:00
wycats
c05f24c824 Speed up content_tag_for by simplifying needed logic 2010-08-31 19:52:26 +09:00
Jaime Iniesta
c2ed4a9f88 Fix API docs for button_to options 2010-08-31 09:19:43 +02:00
Xavier Noria
3805d01c9b resolves merge conflict 2010-08-31 00:24:05 +02:00
José Valim
3c8e1f99b9 Remove NonConcattingString. 2010-08-29 21:15:00 -03:00
José Valim
ba52748d05 Remove deprecated support to <% form_for %> and several ActionController::Base methods. 2010-08-29 21:08:14 -03:00
Joost Baaij
591e87fe7b Expanded routing documentation with current best practices 2010-08-29 00:04:14 +02:00
Joost Baaij
5ead15b075 Rework the routing documentation.
Move the default route to the bottom, as this practise should be discouraged.
Add documentation for resources, external redirects and Rack applications.
2010-08-28 23:24:02 +02:00
Jesse Storimer
730af48963 Ensure that inherited helper_methods are available after calling clear_helpers [#5348 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-28 18:07:01 -03:00
yury
3e22e0b025 Micro optimization for build_named_route_call in PolymorphicRoutes:
1. use map instead of inject
2. use [].join("_") instead of '<<'. It is a little bit faster for ruby 1.9.2 and x2 faster for ruby 1.8.7. http://gist.github.com/548143

[#5450 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-28 17:54:50 -03:00
Santiago Pastorino
1851af84c1 password_field renders with nil value by default
This makes the use of passwords secure by default if you want to render
the value of the password_field you have to do for instance
f.password_field(:password, :value => @user.password) # =>
<input type=password id=user_password name=user[password]
value=#{@user.password} />
2010-08-28 05:23:34 -03:00
Santiago Pastorino
d630c76f3f type="password" for password_fields 2010-08-28 04:53:50 -03:00
Joost Baaij
4b14de72e1 The call-seq directive has no useful effect on our documentation and is not used anywhere else.
Worse still, its use breaks some rdoc, replacing method names with a curly brace.
Having just one call-seq directive doesn't add anything since this is covered by regular rdoc.
Having multiple might make sense, but these are already documented with examples.

This partly re-reverts 60de0e56b7 but does not
touch the vendorized code in html-scanner.
2010-08-28 00:50:50 +02:00
Xavier Noria
dda515fc26 Merge remote branch 'docrails/master' 2010-08-28 00:01:55 +02:00
Joost Baaij
279c395723 Use common terminology 2010-08-27 23:50:23 +02:00
Xavier Noria
27d42a56b9 Revert "call-seq directive makes rdoc cry and replaces method names with a curly brace; besides it doesn't add anything when you only list one call example since this is obviously documented already"
Reason: Part of this commit touches vendorized stuff, the rest is fine, could you please repatch?

This reverts commit 60de0e56b7.
2010-08-27 23:30:52 +02:00
Joost Baaij
4a56f8f314 escape constants that should not be linked to 2010-08-27 22:47:11 +02:00
Joost Baaij
76c569344b mention the alert and notice accessors on the flash 2010-08-27 22:45:35 +02:00