Piotr Sarnacki
153df92f9f
Added documentation on endpoint, middeware stack and routes for Engine
2010-09-03 22:59:07 +02:00
Piotr Sarnacki
ccd422f792
We don't need that initializer in tests
2010-09-03 22:59:07 +02:00
Piotr Sarnacki
1e6612ef80
Ensure that url_helpers included after application's ones have higher priority
2010-09-03 22:59:07 +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
229a868264
Use new url_for API instead of including routes.url_helpers
2010-09-03 22:59:06 +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
b1e5e233fa
Refactored tests for prefix generation and added test for url generation in regular class with default_url_options[:script_name] set
2010-09-03 22:59:05 +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
177a4bd5b7
Fix url generation for mounted Engine
...
I added integration tests for generating urls in Engine and application
and tweaked Engines to fully cooparate with new router's behavior:
* Rails.application now sets ORIGINAL_SCRIPT_NAME
* Rails.application also sets its routes as env['action_dispatch.parent_routes']
* Engine implements responds_to? class method to respond to all the
instance methods, like #routes
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
628b94fbc8
Pass routes via env['action_dispatch.routes'], it's needed by routes to determine if it should generate prefix for mounted apps
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
32a5b49911
Move singleton pattern to Railtie and remove Engine::Configurable and Application::Configurable in favor of unified Railtie::Configurable
2010-09-03 22:59:05 +02:00
Piotr Sarnacki
939d4255e6
Removed most of deprecated stuff from Application and Engine
2010-09-03 22:59:04 +02:00
Piotr Sarnacki
7cccfed594
Allow Engines loading its own environment file from config/environments
2010-09-03 22:59:04 +02:00
Piotr Sarnacki
15f95b98ac
Ensure that plugins are not loaded twice
2010-09-03 22:59:04 +02:00
Piotr Sarnacki
efe9555cd7
We don't need to add railties initlaizers in Application as there is already done in Engine and it's called with super
2010-09-03 22:59:04 +02:00
Piotr Sarnacki
3939d6bb51
Removed ActionDispatch::Static, but left empty MiddlewareStack to unify app method between Engine and Application
2010-09-03 22:59:04 +02:00
Piotr Sarnacki
7d7263bf9d
We don't need to overwrite default paths in tests
2010-09-03 22:59:04 +02:00
Piotr Sarnacki
e4bd7ed2fa
Ensure that init.rb is evaled in context of Engine
2010-09-03 22:59:04 +02:00
Piotr Sarnacki
092b148b21
Engine can now serve files with ActionDispatch::Static
2010-09-03 22:59:04 +02:00
Piotr Sarnacki
c989d1a87d
Engine sets routes as default rack endpoint if no endpoint was given
2010-09-03 22:59:04 +02:00
Piotr Sarnacki
b5975a4a30
Delegate non existing class methods to instance for Engine
2010-09-03 22:59:03 +02:00
Piotr Sarnacki
7c8f73d1bd
Added TODO for evaling init.rb in context of Engine
2010-09-03 22:59:03 +02:00
Piotr Sarnacki
675f3ead41
Gather initializers from railties in engines to get rid of additional looping through initializers
2010-09-03 22:59:03 +02:00
Piotr Sarnacki
c787bfdf93
Engine can now load its own plugins
2010-09-03 22:59:03 +02:00
Piotr Sarnacki
ad6be08762
Made Engine valid rack app with its own middleware stack
2010-09-03 22:59:03 +02:00
Piotr Sarnacki
f7af75976a
require 'active_support/dependencies' in action_dispatch/middleware/stack
2010-09-03 22:59:03 +02:00
Xavier Noria
63032c1162
too many people are looking for the 2.3 guides, put by now a link at the top of the home, and add the Rails version in the main header
2010-09-03 22:00:22 +02:00
Xavier Noria
93acbf6bf3
Merge remote branch 'docrails/master'
2010-09-03 21:30:22 +02:00
Ken Collins
d28438caf2
A few schema changes for the SQL Server adapter.
...
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2010-09-03 14:57:16 +12: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 38a421b34d0b414564e919f67d339fac067a56e6.
2010-09-02 21:11:03 +02:00
rohit
13d2a08164
Add two integration tests for GeneratedAttribute missing type error. [ #5461 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 12:59:21 +02:00
rohit
d2fc5e2f65
Output a friendly message when no type given for GeneratedAttribute [ #5461 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 12:59:21 +02:00
rohit
8ffa695cec
Failing test for GeneratedAttribute [ #5461 state:open]
...
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 12:59:21 +02:00
Andreas Garnæs
1503e45e2e
ActiveModel#to_xml fix (renamed parameter).
...
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 12:55:45 +02:00
José Valim
b8f3b262e0
Remove deprecated dispatch test.
2010-09-02 12:55:14 +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
Thiago Pradi
7698596adb
Removing unnecessary code from render_test
...
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 11:51:01 +02:00
Thiago Pradi
08187efa5b
Removing unnecessary code
...
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 11:50:51 +02:00
Greg Hazel
3f49456f5b
remove use of echo [ #4410 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 11:50:38 +02:00
Akira Matsuda
4d9b2da5f3
"rails console t" must not load "production" but "test"
...
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 11:50:31 +02:00
Santiago Pastorino
920765c4c2
Add ruby-debug19 for mri 1.9
2010-09-01 21:24:33 -03:00