railties 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushAS3.js +59 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushAppleScript.js +75 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushBash.js +59 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushCSharp.js +65 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushColdFusion.js +100 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushCpp.js +97 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushCss.js +91 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushDelphi.js +55 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushDiff.js +41 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushErlang.js +52 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushGroovy.js +67 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushJScript.js +52 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushJava.js +57 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushJavaFX.js +58 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPerl.js +72 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPhp.js +88 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPlain.js +33 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPowerShell.js +74 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPython.js +64 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushRuby.js +55 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushSass.js +94 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushScala.js +51 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushSql.js +66 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushVb.js +56 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushXml.js +69 -0
- data/guides/assets/javascripts/syntaxhighlighter/shCore.js +17 -0
- data/guides/assets/stylesheets/main.css +6 -13
- data/guides/assets/stylesheets/syntaxhighlighter/shCore.css +226 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreDefault.css +328 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreDjango.css +331 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreEclipse.css +339 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreEmacs.css +324 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreFadeToGrey.css +328 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreMDUltra.css +324 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreMidnight.css +324 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreRDark.css +324 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeDefault.css +117 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeDjango.css +120 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeEclipse.css +128 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeEmacs.css +113 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeFadeToGrey.css +117 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeMDUltra.css +113 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeMidnight.css +113 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeRDark.css +113 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeRailsGuides.css +116 -0
- data/guides/rails_guides/generator.rb +21 -3
- data/guides/source/3_0_release_notes.textile +3 -7
- data/guides/source/action_controller_overview.textile +8 -1
- data/guides/source/action_mailer_basics.textile +1 -1
- data/guides/source/action_view_overview.textile +1 -1
- data/guides/source/active_record_querying.textile +44 -50
- data/guides/source/active_record_validations_callbacks.textile +3 -3
- data/guides/source/caching_with_rails.textile +1 -1
- data/guides/source/configuring.textile +3 -3
- data/guides/source/debugging_rails_applications.textile +6 -4
- data/guides/source/form_helpers.textile +21 -15
- data/guides/source/getting_started.textile +2 -12
- data/guides/source/i18n.textile +6 -0
- data/guides/source/index.html.erb +10 -2
- data/guides/source/layout.html.erb +13 -5
- data/guides/source/layouts_and_rendering.textile +2 -2
- data/guides/source/migrations.textile +1 -1
- data/guides/source/performance_testing.textile +6 -6
- data/guides/source/plugins.textile +9 -9
- data/guides/source/routing.textile +45 -25
- data/guides/source/ruby_on_rails_guides_guidelines.textile +77 -0
- data/lib/rails/application/configuration.rb +2 -0
- data/lib/rails/application/finisher.rb +7 -0
- data/lib/rails/code_statistics.rb +1 -1
- data/lib/rails/commands/console.rb +1 -1
- data/lib/rails/commands/runner.rb +2 -2
- data/lib/rails/engine/configuration.rb +6 -0
- data/lib/rails/generators/generated_attribute.rb +1 -0
- data/lib/rails/generators/rails/app/app_generator.rb +7 -4
- data/lib/rails/generators/rails/app/templates/Gemfile +2 -3
- data/lib/rails/generators/rails/app/templates/README +1 -1
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt +1 -1
- data/lib/rails/generators/resource_helpers.rb +1 -1
- data/lib/rails/plugin.rb +1 -1
- data/lib/rails/railtie.rb +1 -1
- data/lib/rails/railtie/configuration.rb +4 -3
- data/lib/rails/ruby_version_check.rb +1 -2
- data/lib/rails/tasks/misc.rake +1 -1
- data/lib/rails/version.rb +2 -2
- metadata +70 -15
- data/guides/assets/javascripts/code_highlighter.js +0 -188
- data/guides/assets/javascripts/highlighters.js +0 -90
- data/guides/assets/stylesheets/syntax.css +0 -31
@@ -39,10 +39,10 @@ You can also generate paths and URLs. If your application contains this code:
|
|
39
39
|
</ruby>
|
40
40
|
|
41
41
|
<erb>
|
42
|
-
<%= link_to "Patient Record",
|
42
|
+
<%= link_to "Patient Record", patient_path(@patient) %>
|
43
43
|
</erb>
|
44
44
|
|
45
|
-
The router will generate the path +/patients/17+. This reduces the brittleness of your view and makes your code easier to understand.
|
45
|
+
The router will generate the path +/patients/17+. This reduces the brittleness of your view and makes your code easier to understand. Note that the id does not need to be specified in the route helper.
|
46
46
|
|
47
47
|
h3. Resource Routing: the Rails Default
|
48
48
|
|
@@ -91,7 +91,7 @@ Creating a resourceful route will also expose a number of helpers to the control
|
|
91
91
|
|
92
92
|
* +photos_path+ returns +/photos+
|
93
93
|
* +new_photo_path+ returns +/photos/new+
|
94
|
-
* +edit_photo_path+ returns +/photos/edit+
|
94
|
+
* +edit_photo_path(id)+ returns +/photos/:id/edit+ (for instance, +edit_photo_path(10)+ returns +/photos/10/edit+)
|
95
95
|
* +photo_path(id)+ returns +/photos/:id+ (for instance, +photo_path(10)+ returns +/photos/10+)
|
96
96
|
|
97
97
|
Each of these helpers has a corresponding +_url+ helper (such as +photos_url+) which returns the same path prefixed with the current host, port and path prefix.
|
@@ -116,7 +116,7 @@ resources :videos
|
|
116
116
|
|
117
117
|
h4. Singular Resources
|
118
118
|
|
119
|
-
Sometimes, you have a resource that clients always look up without referencing an ID.
|
119
|
+
Sometimes, you have a resource that clients always look up without referencing an ID. For example, you would like +/profile+ to always show the profile of the currently logged in user. In this case, you can use a singular resource to map +/profile+ (rather than +/profile/:id+) to the +show+ action.
|
120
120
|
|
121
121
|
<ruby>
|
122
122
|
match "profile" => "users#show"
|
@@ -161,15 +161,15 @@ end
|
|
161
161
|
This will create a number of routes for each of the +posts+ and +comments+ controller. For +Admin::PostsController+, Rails will create:
|
162
162
|
|
163
163
|
|_. Verb |_.Path |_.action |_. helper |
|
164
|
-
|GET |/admin/
|
165
|
-
|GET |/admin/
|
166
|
-
|POST |/admin/
|
167
|
-
|GET |/admin/
|
168
|
-
|GET |/admin/
|
169
|
-
|PUT |/admin/
|
170
|
-
|DELETE |/admin/
|
164
|
+
|GET |/admin/posts |index | admin_posts_path |
|
165
|
+
|GET |/admin/posts/new |new | new_admin_posts_path |
|
166
|
+
|POST |/admin/posts |create | admin_posts_path |
|
167
|
+
|GET |/admin/posts/1 |show | admin_post_path(id) |
|
168
|
+
|GET |/admin/posts/1/edit |edit | edit_admin_post_path(id) |
|
169
|
+
|PUT |/admin/posts/1 |update | admin_post_path(id) |
|
170
|
+
|DELETE |/admin/posts/1 |destroy | admin_post_path(id) |
|
171
171
|
|
172
|
-
If you want to route +/
|
172
|
+
If you want to route +/posts+ (without the prefix +/admin+) to +Admin::PostsController+, you could use
|
173
173
|
|
174
174
|
<ruby>
|
175
175
|
scope :module => "admin" do
|
@@ -183,7 +183,7 @@ or, for a single case
|
|
183
183
|
resources :posts, :module => "admin"
|
184
184
|
</ruby>
|
185
185
|
|
186
|
-
If you want to route +/admin/
|
186
|
+
If you want to route +/admin/posts+ to +PostsController+ (without the +Admin::+ module prefix), you could use
|
187
187
|
|
188
188
|
<ruby>
|
189
189
|
scope "/admin" do
|
@@ -200,13 +200,13 @@ resources :posts, :path => "/admin"
|
|
200
200
|
In each of these cases, the named routes remain the same as if you did not use +scope+. In the last case, the following paths map to +PostsController+:
|
201
201
|
|
202
202
|
|_. Verb |_.Path |_.action |_. helper |
|
203
|
-
|GET |/admin/
|
204
|
-
|GET |/admin/
|
205
|
-
|POST |/admin/
|
206
|
-
|GET |/admin/
|
207
|
-
|GET |/admin/
|
208
|
-
|PUT |/admin/
|
209
|
-
|DELETE |/admin/
|
203
|
+
|GET |/admin/posts |index | posts_path |
|
204
|
+
|GET |/admin/posts/new |new | posts_path |
|
205
|
+
|POST |/admin/posts |create | posts_path |
|
206
|
+
|GET |/admin/posts/1 |show | post_path(id) |
|
207
|
+
|GET |/admin/posts/1/edit |edit | edit_post_path(id) |
|
208
|
+
|PUT |/admin/posts/1 |update | post_path(id) |
|
209
|
+
|DELETE |/admin/posts/1 |destroy | post_path(id) |
|
210
210
|
|
211
211
|
h4. Nested Resources
|
212
212
|
|
@@ -370,7 +370,7 @@ When you set up a regular route, you supply a series of symbols that Rails maps
|
|
370
370
|
match ':controller(/:action(/:id))'
|
371
371
|
</ruby>
|
372
372
|
|
373
|
-
If an incoming request of +/photos/show/1+ is processed by this route (because it hasn't matched any previous route in the file), then the result will be to invoke the +show+ action of the +PhotosController+, and to make the final parameter +"1"+ available as +params[:id]+. This route will also route the incoming request of +/photos+ to +PhotosController+, since +:action+ and +:id+ are optional parameters, denoted by parentheses.
|
373
|
+
If an incoming request of +/photos/show/1+ is processed by this route (because it hasn't matched any previous route in the file), then the result will be to invoke the +show+ action of the +PhotosController+, and to make the final parameter +"1"+ available as +params[:id]+. This route will also route the incoming request of +/photos+ to +PhotosController#index+, since +:action+ and +:id+ are optional parameters, denoted by parentheses.
|
374
374
|
|
375
375
|
h4. Dynamic Segments
|
376
376
|
|
@@ -434,7 +434,27 @@ You can specify a name for any route using the +:as+ option.
|
|
434
434
|
match 'exit' => 'sessions#destroy', :as => :logout
|
435
435
|
</ruby>
|
436
436
|
|
437
|
-
This will create +logout_path+ and +logout_url+ as named helpers in your application. Calling +logout_path+ will return +/
|
437
|
+
This will create +logout_path+ and +logout_url+ as named helpers in your application. Calling +logout_path+ will return +/exit+
|
438
|
+
|
439
|
+
h4. HTTP Verb Constraints
|
440
|
+
|
441
|
+
You can use the +:via+ option to constrain the request to one or more HTTP methods:
|
442
|
+
|
443
|
+
<ruby>
|
444
|
+
match 'photos/show' => 'photos#show', :via => :get
|
445
|
+
</ruby>
|
446
|
+
|
447
|
+
There is a shorthand version of this as well:
|
448
|
+
|
449
|
+
<ruby>
|
450
|
+
get 'photos/show'
|
451
|
+
</ruby>
|
452
|
+
|
453
|
+
You can also permit more than one verb to a single route:
|
454
|
+
|
455
|
+
<ruby>
|
456
|
+
match 'photos/show' => 'photos#show', :via => [:get, :post]
|
457
|
+
</ruby>
|
438
458
|
|
439
459
|
h4. Segment Constraints
|
440
460
|
|
@@ -589,7 +609,7 @@ The +:controller+ option lets you explicitly specify a controller to use for the
|
|
589
609
|
resources :photos, :controller => "images"
|
590
610
|
</ruby>
|
591
611
|
|
592
|
-
will recognize incoming paths beginning with +/
|
612
|
+
will recognize incoming paths beginning with +/photos+ but route to the +Images+ controller:
|
593
613
|
|
594
614
|
|_. Verb |_.Path |_.action |
|
595
615
|
|GET |/photos |index |
|
@@ -723,7 +743,7 @@ scope(:path_names => { :new => "neu", :edit => "bearbeiten" }) do
|
|
723
743
|
end
|
724
744
|
</ruby>
|
725
745
|
|
726
|
-
Rails now creates routes to the +
|
746
|
+
Rails now creates routes to the +CategoriesController+.
|
727
747
|
|
728
748
|
|_.HTTP verb|_.Path |_.action |
|
729
749
|
|GET |/kategorien |index |
|
@@ -788,7 +808,7 @@ TIP: You'll find that the output from +rake routes+ is much more readable if you
|
|
788
808
|
|
789
809
|
h4. Testing Routes
|
790
810
|
|
791
|
-
Routes should be included in your testing strategy (just like the rest of your application). Rails offers three "built-in assertions":http://api.rubyonrails.org/classes/
|
811
|
+
Routes should be included in your testing strategy (just like the rest of your application). Rails offers three "built-in assertions":http://api.rubyonrails.org/classes/ActionDispatch/Assertions/RoutingAssertions.html designed to make testing routes simpler:
|
792
812
|
|
793
813
|
* +assert_generates+
|
794
814
|
* +assert_recognizes+
|
@@ -0,0 +1,77 @@
|
|
1
|
+
h2. Ruby on Rails Guides Guidelines
|
2
|
+
|
3
|
+
This guide documents guidelines for writing guides. This guide follows itself in a gracile loop.
|
4
|
+
|
5
|
+
endprologue.
|
6
|
+
|
7
|
+
h3. Textile
|
8
|
+
|
9
|
+
Guides are written in "Textile":http://www.textism.com/tools/textile/. There's comprehensive documentation "here":http://redcloth.org/hobix.com/textile/ and a cheatsheet for markup "here":http://redcloth.org/hobix.com/textile/quick.html.
|
10
|
+
|
11
|
+
h3. Prologue
|
12
|
+
|
13
|
+
Each guide should start with motivational text at the top. That's the little introduction in the blue area. The prologue should tell the readers what's the guide about, and what will they learn. See for example the "Routing Guide":routing.html.
|
14
|
+
|
15
|
+
h3. Titles
|
16
|
+
|
17
|
+
The title of every guide uses +h2+, guide sections use +h3+, subsections +h4+, etc.
|
18
|
+
|
19
|
+
Capitalize all words except for internal articles, prepositions, conjuctions, and forms of the verb to be:
|
20
|
+
|
21
|
+
<plain>
|
22
|
+
h5. Middleware Stack is an Array
|
23
|
+
h5. When are Objects Saved?
|
24
|
+
</plain>
|
25
|
+
|
26
|
+
Use same typography as in regular text:
|
27
|
+
|
28
|
+
<plain>
|
29
|
+
h6. The +:content_type+ Option
|
30
|
+
</plain>
|
31
|
+
|
32
|
+
h3. API Documentation Guidelines
|
33
|
+
|
34
|
+
The guides and the API should be coherent where appropriate. Please have a look at these particular sections of the "API Documentation Guidelines":api_documentation_guidelines.html:
|
35
|
+
|
36
|
+
* "Wording":api_documentation_guidelines.html#wording
|
37
|
+
* "Example Code":api_documentation_guidelines.html#example-code
|
38
|
+
* "Filenames":api_documentation_guidelines.html#filenames
|
39
|
+
* "Fonts":api_documentation_guidelines.html#fonts
|
40
|
+
|
41
|
+
Those guidelines apply also to guides.
|
42
|
+
|
43
|
+
h3. HTML Generation
|
44
|
+
|
45
|
+
To generate all the guides just cd into the +railties+ directory and execute
|
46
|
+
|
47
|
+
<plain>
|
48
|
+
rake generate_guides
|
49
|
+
</plain>
|
50
|
+
|
51
|
+
You'll need the gems erubis, i18n, and RedCloth.
|
52
|
+
|
53
|
+
To process +my_guide.textile+ and nothing else use the +ONLY+ environment variable:
|
54
|
+
|
55
|
+
<plain>
|
56
|
+
rake generate_guides ONLY=my_guide
|
57
|
+
</plain>
|
58
|
+
|
59
|
+
Although by default guides that have not been modified are not processed, so +ONLY+ is rarely needed in practice.
|
60
|
+
|
61
|
+
To force process of al the guides pass +ALL=1+.
|
62
|
+
|
63
|
+
It is also recommended that you work with +WARNINGS=1+, this detects duplicate IDs and warns about broken internal links.
|
64
|
+
|
65
|
+
h3. HTML validation
|
66
|
+
|
67
|
+
Please do validate the generated HTML with
|
68
|
+
|
69
|
+
<plain>
|
70
|
+
rake validate_guides
|
71
|
+
</plain>
|
72
|
+
|
73
|
+
Particularly, titles get an ID generated from their content and this often leads to duplicates. Please set +WARNINGS=1+ when generating guides to detect them. The warning messages suggest a way to fix them.
|
74
|
+
|
75
|
+
h3. Changelog
|
76
|
+
|
77
|
+
* October 5, 2010: ported from the docrails wiki and revised by "Xavier Noria":credits.html#fxn
|
@@ -46,6 +46,13 @@ module Rails
|
|
46
46
|
ActiveSupport.run_load_hooks(:after_initialize, self)
|
47
47
|
end
|
48
48
|
|
49
|
+
# Force routes to be loaded just at the end and add it to to_prepare callbacks
|
50
|
+
initializer :set_routes_reloader do |app|
|
51
|
+
reloader = lambda { app.routes_reloader.execute_if_updated }
|
52
|
+
reloader.call
|
53
|
+
ActionDispatch::Callbacks.to_prepare(&reloader)
|
54
|
+
end
|
55
|
+
|
49
56
|
# Disable dependency loading during request cycle
|
50
57
|
initializer :disable_dependency_loading do
|
51
58
|
if config.cache_classes && !config.dependency_loading
|
@@ -23,7 +23,7 @@ class CodeStatistics #:nodoc:
|
|
23
23
|
|
24
24
|
private
|
25
25
|
def calculate_statistics
|
26
|
-
@pairs.
|
26
|
+
Hash[@pairs.map{|pair| [pair.first, calculate_directory_statistics(pair.last)]}]
|
27
27
|
end
|
28
28
|
|
29
29
|
def calculate_directory_statistics(directory, pattern = /.*\.rb$/)
|
@@ -48,5 +48,5 @@ end
|
|
48
48
|
|
49
49
|
# Has to set the RAILS_ENV before config/application is required
|
50
50
|
if ARGV.first && !ARGV.first.index("-") && env = ARGV.pop # has to pop the env ARGV so IRB doesn't freak
|
51
|
-
ENV['RAILS_ENV'] = %w(production development test).
|
51
|
+
ENV['RAILS_ENV'] = %w(production development test).detect {|e| e =~ /^#{env}/} || env
|
52
52
|
end
|
@@ -17,13 +17,13 @@ ARGV.clone.options do |opts|
|
|
17
17
|
opts.separator ""
|
18
18
|
|
19
19
|
opts.on("-h", "--help",
|
20
|
-
"Show this help message.") { $
|
20
|
+
"Show this help message.") { $stdout.puts opts; exit }
|
21
21
|
|
22
22
|
if RbConfig::CONFIG['host_os'] !~ /mswin|mingw/
|
23
23
|
opts.separator ""
|
24
24
|
opts.separator "You can also use runner as a shebang line for your scripts like this:"
|
25
25
|
opts.separator "-------------------------------------------------------------"
|
26
|
-
opts.separator "#!/usr/bin/env #{File.expand_path($0)}"
|
26
|
+
opts.separator "#!/usr/bin/env #{File.expand_path($0)} runner"
|
27
27
|
opts.separator ""
|
28
28
|
opts.separator "Product.find(:all).each { |p| p.price *= 2 ; p.save! }"
|
29
29
|
opts.separator "-------------------------------------------------------------"
|
@@ -33,6 +33,12 @@ module Rails
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
def generators #:nodoc:
|
37
|
+
ActiveSupport::Deprecation.warn "config.generators in Rails::Engine is deprecated. " <<
|
38
|
+
"Please use config.app_generators instead."
|
39
|
+
super
|
40
|
+
end
|
41
|
+
|
36
42
|
def root=(value)
|
37
43
|
@root = paths.path = Pathname.new(value).expand_path
|
38
44
|
end
|
@@ -353,18 +353,21 @@ module Rails
|
|
353
353
|
end
|
354
354
|
|
355
355
|
def app_name
|
356
|
-
@app_name ||= File.basename(destination_root)
|
356
|
+
@app_name ||= defined_app_const_base? ? defined_app_name : File.basename(destination_root)
|
357
|
+
end
|
358
|
+
|
359
|
+
def defined_app_name
|
360
|
+
defined_app_const_base.underscore
|
357
361
|
end
|
358
|
-
|
359
|
-
alias_method :defined_app_name, :app_name
|
360
362
|
|
361
363
|
def defined_app_const_base
|
362
364
|
Rails.respond_to?(:application) && defined?(Rails::Application) &&
|
363
365
|
Rails.application.is_a?(Rails::Application) && Rails.application.class.name.sub(/::Application$/, "")
|
364
366
|
end
|
365
367
|
|
368
|
+
alias :defined_app_const_base? :defined_app_const_base
|
369
|
+
|
366
370
|
def app_const_base
|
367
|
-
defined_app_name # ensures the correct app_name if it's already defined
|
368
371
|
@app_const_base ||= defined_app_const_base || app_name.gsub(/\W/, '_').squeeze('_').camelize
|
369
372
|
end
|
370
373
|
|
@@ -2,10 +2,8 @@ source 'http://rubygems.org'
|
|
2
2
|
|
3
3
|
<%- if options.dev? -%>
|
4
4
|
gem 'rails', :path => '<%= Rails::Generators::RAILS_DEV_PATH %>'
|
5
|
-
gem 'arel', :git => 'git://github.com/rails/arel.git'
|
6
5
|
<%- elsif options.edge? -%>
|
7
6
|
gem 'rails', :git => 'git://github.com/rails/rails.git'
|
8
|
-
gem 'arel', :git => 'git://github.com/rails/arel.git'
|
9
7
|
<%- else -%>
|
10
8
|
gem 'rails', '<%= Rails::VERSION::STRING %>'
|
11
9
|
|
@@ -23,8 +21,9 @@ gem '<%= gem_for_database %>'<% if require_for_database %>, :require => '<%= req
|
|
23
21
|
# Deploy with Capistrano
|
24
22
|
# gem 'capistrano'
|
25
23
|
|
26
|
-
# To use debugger
|
24
|
+
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
|
27
25
|
# gem 'ruby-debug'
|
26
|
+
# gem 'ruby-debug19'
|
28
27
|
|
29
28
|
# Bundle the extra gems:
|
30
29
|
# gem 'bj'
|
@@ -158,6 +158,7 @@ The default directory structure of a generated Ruby on Rails application:
|
|
158
158
|
|-- app
|
159
159
|
| |-- controllers
|
160
160
|
| |-- helpers
|
161
|
+
| |-- mailers
|
161
162
|
| |-- models
|
162
163
|
| `-- views
|
163
164
|
| `-- layouts
|
@@ -175,7 +176,6 @@ The default directory structure of a generated Ruby on Rails application:
|
|
175
176
|
| |-- javascripts
|
176
177
|
| `-- stylesheets
|
177
178
|
|-- script
|
178
|
-
| `-- performance
|
179
179
|
|-- test
|
180
180
|
| |-- fixtures
|
181
181
|
| |-- functional
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= app_const %>.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
3
|
|
4
4
|
# In the development environment your application's code is reloaded on
|
5
5
|
# every request. This slows down response time but is perfect for development
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= app_const %>.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
3
|
|
4
4
|
# The production environment is meant for finished, "live" apps.
|
5
5
|
# Code is not reloaded between requests
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= app_const %>.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
3
|
|
4
4
|
# The test environment is used exclusively to run your application's
|
5
5
|
# test suite. You never need to work with it otherwise. Remember that
|
@@ -4,5 +4,5 @@
|
|
4
4
|
|
5
5
|
# Use the database for sessions instead of the cookie-based default,
|
6
6
|
# which shouldn't be used to store highly confidential information
|
7
|
-
# (create the session table with "
|
7
|
+
# (create the session table with "rails generate session_migration")
|
8
8
|
# <%= app_const %>.config.session_store :active_record_store
|
@@ -17,7 +17,7 @@ module Rails
|
|
17
17
|
def initialize(*args) #:nodoc:
|
18
18
|
super
|
19
19
|
|
20
|
-
if name == name.pluralize && !options[:force_plural]
|
20
|
+
if name == name.pluralize && name.singularize != name.pluralize && !options[:force_plural]
|
21
21
|
unless ResourceHelpers.skip_warn
|
22
22
|
say "Plural version of the model detected, using singularized version. Override with --force-plural."
|
23
23
|
ResourceHelpers.skip_warn = true
|
data/lib/rails/plugin.rb
CHANGED
@@ -84,7 +84,7 @@ module Rails
|
|
84
84
|
|
85
85
|
initializer :sanity_check_railties_collision do
|
86
86
|
if Engine.subclasses.map { |k| k.root.to_s }.include?(root.to_s)
|
87
|
-
raise "\"#{name}\" is a Railtie/Engine and cannot be installed as plugin"
|
87
|
+
raise "\"#{name}\" is a Railtie/Engine and cannot be installed as a plugin"
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
data/lib/rails/railtie.rb
CHANGED
@@ -84,7 +84,7 @@ module Rails
|
|
84
84
|
#
|
85
85
|
# class MyRailtie < Rails::Railtie
|
86
86
|
# # Customize the ORM
|
87
|
-
# config.
|
87
|
+
# config.app_generators.orm :my_railtie_orm
|
88
88
|
#
|
89
89
|
# # Add a to_prepare block which is executed once in production
|
90
90
|
# # and before which request in development
|
@@ -18,7 +18,7 @@ module Rails
|
|
18
18
|
|
19
19
|
# Holds generators configuration:
|
20
20
|
#
|
21
|
-
# config.
|
21
|
+
# config.app_generators do |g|
|
22
22
|
# g.orm :datamapper, :migration => true
|
23
23
|
# g.template_engine :haml
|
24
24
|
# g.test_framework :rspec
|
@@ -26,9 +26,9 @@ module Rails
|
|
26
26
|
#
|
27
27
|
# If you want to disable color in console, do:
|
28
28
|
#
|
29
|
-
# config.
|
29
|
+
# config.app_generators.colorize_logging = false
|
30
30
|
#
|
31
|
-
def
|
31
|
+
def app_generators
|
32
32
|
@@generators ||= Rails::Configuration::Generators.new
|
33
33
|
if block_given?
|
34
34
|
yield @@generators
|
@@ -36,6 +36,7 @@ module Rails
|
|
36
36
|
@@generators
|
37
37
|
end
|
38
38
|
end
|
39
|
+
alias :generators :app_generators
|
39
40
|
|
40
41
|
def before_configuration(&block)
|
41
42
|
ActiveSupport.on_load(:before_configuration, :yield => true, &block)
|