railties 3.2.3 → 3.2.4.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. data/CHANGELOG.md +5 -0
  2. data/README.rdoc +1 -1
  3. data/guides/code/getting_started/Gemfile +1 -1
  4. data/guides/source/action_controller_overview.textile +5 -4
  5. data/guides/source/association_basics.textile +2 -2
  6. data/guides/source/caching_with_rails.textile +10 -8
  7. data/guides/source/configuring.textile +1 -1
  8. data/guides/source/contributing_to_ruby_on_rails.textile +34 -2
  9. data/guides/source/debugging_rails_applications.textile +1 -1
  10. data/guides/source/getting_started.textile +20 -5
  11. data/lib/rails/application.rb +1 -1
  12. data/lib/rails/commands.rb +7 -3
  13. data/lib/rails/engine/commands.rb +4 -0
  14. data/lib/rails/generators.rb +2 -0
  15. data/lib/rails/generators/app_base.rb +3 -3
  16. data/lib/rails/generators/base.rb +17 -4
  17. data/lib/rails/generators/named_base.rb +4 -0
  18. data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css +1 -1
  19. data/lib/rails/generators/rails/app/templates/config/application.rb +3 -0
  20. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +1 -1
  21. data/lib/rails/generators/rails/controller/templates/controller.rb +4 -0
  22. data/lib/rails/generators/rails/resource/resource_generator.rb +1 -7
  23. data/lib/rails/generators/rails/resource_route/resource_route_generator.rb +13 -0
  24. data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +4 -0
  25. data/lib/rails/generators/test_case.rb +2 -2
  26. data/lib/rails/rack/log_tailer.rb +7 -3
  27. data/lib/rails/tasks/documentation.rake +1 -1
  28. data/lib/rails/version.rb +2 -2
  29. metadata +65 -51
@@ -1,3 +1,8 @@
1
+ ## Rails 3.2.4 (unreleased) ##
2
+
3
+ * Add hook for resource route's generator. *Santiago Pastorino*
4
+
5
+
1
6
  ## Rails 3.2.3 (unreleased) ##
2
7
 
3
8
  * No changes.
@@ -17,7 +17,7 @@ The latest version of Railties can be installed with RubyGems:
17
17
 
18
18
  Source code can be downloaded as part of the Rails project on GitHub
19
19
 
20
- * https://github.com/rails/rails/tree/master/railties
20
+ * https://github.com/rails/rails/tree/3-2-stable/railties
21
21
 
22
22
  == License
23
23
 
@@ -35,4 +35,4 @@ gem 'jquery-rails'
35
35
  # gem 'capistrano'
36
36
 
37
37
  # To use debugger
38
- # gem 'ruby-debug19', :require => 'ruby-debug'
38
+ # gem 'debugger'
@@ -148,18 +148,19 @@ In this case, when a user opens the URL +/clients/active+, +params[:status]+ wil
148
148
 
149
149
  h4. +default_url_options+
150
150
 
151
- You can set global default parameters that will be used when generating URLs with +default_url_options+. To do this, define a method with that name in your controller:
151
+ You can set global default parameters for URL generation by defining a method called +default_url_options+ in your controller. Such a method must return a hash with the desired defaults, whose keys must be symbols:
152
152
 
153
153
  <ruby>
154
154
  class ApplicationController < ActionController::Base
155
- # The options parameter is the hash passed in to 'url_for'
156
- def default_url_options(options)
155
+ def default_url_options
157
156
  {:locale => I18n.locale}
158
157
  end
159
158
  end
160
159
  </ruby>
161
160
 
162
- These options will be used as a starting-point when generating URLs, so it's possible they'll be overridden by +url_for+. Because this method is defined in the controller, you can define it on +ApplicationController+ so it would be used for all URL generation, or you could define it on only one controller for all URLs generated there.
161
+ These options will be used as a starting point when generating URLs, so it's possible they'll be overridden by the options passed in +url_for+ calls.
162
+
163
+ If you define +default_url_options+ in +ApplicationController+, as in the example above, it would be used for all URL generation. The method can also be defined in one specific controller, in which case it only affects URLs generated there.
163
164
 
164
165
 
165
166
  h3. Session
@@ -342,9 +342,9 @@ In designing a data model, you will sometimes find a model that should have a re
342
342
 
343
343
  <ruby>
344
344
  class Employee < ActiveRecord::Base
345
- has_many :subordinates, :class_name => "Employee"
346
- belongs_to :manager, :class_name => "Employee",
345
+ has_many :subordinates, :class_name => "Employee",
347
346
  :foreign_key => "manager_id"
347
+ belongs_to :manager, :class_name => "Employee"
348
348
  end
349
349
  </ruby>
350
350
 
@@ -257,7 +257,9 @@ However, it's important to note that query caches are created at the start of an
257
257
 
258
258
  h3. Cache Stores
259
259
 
260
- Rails provides different stores for the cached data created by action and fragment caches. Page caches are always stored on disk.
260
+ Rails provides different stores for the cached data created by <b>action</b> and <b>fragment</b> caches.
261
+
262
+ TIP: Page caches are always stored on disk.
261
263
 
262
264
  h4. Configuration
263
265
 
@@ -267,7 +269,7 @@ You can set up your application's default cache store by calling +config.cache_s
267
269
  config.cache_store = :memory_store
268
270
  </ruby>
269
271
 
270
- Alternatively, you can call +ActionController::Base.cache_store+ outside of a configuration block.
272
+ NOTE: Alternatively, you can call +ActionController::Base.cache_store+ outside of a configuration block.
271
273
 
272
274
  You can access the cache by calling +Rails.cache+.
273
275
 
@@ -294,7 +296,7 @@ h4. ActiveSupport::Cache::MemoryStore
294
296
  This cache store keeps entries in memory in the same Ruby process. The cache store has a bounded size specified by the +:size+ options to the initializer (default is 32Mb). When the cache exceeds the allotted size, a cleanup will occur and the least recently used entries will be removed.
295
297
 
296
298
  <ruby>
297
- ActionController::Base.cache_store = :memory_store, :size => 64.megabytes
299
+ config.cache_store = :memory_store, :size => 64.megabytes
298
300
  </ruby>
299
301
 
300
302
  If you're running multiple Ruby on Rails server processes (which is the case if you're using mongrel_cluster or Phusion Passenger), then your Rails server process instances won't be able to share cache data with each other. This cache store is not appropriate for large application deployments, but can work well for small, low traffic sites with only a couple of server processes or for development and test environments.
@@ -306,7 +308,7 @@ h4. ActiveSupport::Cache::FileStore
306
308
  This cache store uses the file system to store entries. The path to the directory where the store files will be stored must be specified when initializing the cache.
307
309
 
308
310
  <ruby>
309
- ActionController::Base.cache_store = :file_store, "/path/to/cache/directory"
311
+ config.cache_store = :file_store, "/path/to/cache/directory"
310
312
  </ruby>
311
313
 
312
314
  With this cache store, multiple server processes on the same host can share a cache. Servers processes running on different hosts could share a cache by using a shared file system, but that set up would not be ideal and is not recommended. The cache store is appropriate for low to medium traffic sites that are served off one or two hosts.
@@ -322,7 +324,7 @@ When initializing the cache, you need to specify the addresses for all memcached
322
324
  The +write+ and +fetch+ methods on this cache accept two additional options that take advantage of features specific to memcached. You can specify +:raw+ to send a value directly to the server with no serialization. The value must be a string or number. You can use memcached direct operation like +increment+ and +decrement+ only on raw values. You can also specify +:unless_exist+ if you don't want memcached to overwrite an existing entry.
323
325
 
324
326
  <ruby>
325
- ActionController::Base.cache_store = :mem_cache_store, "cache-1.example.com", "cache-2.example.com"
327
+ config.cache_store = :mem_cache_store, "cache-1.example.com", "cache-2.example.com"
326
328
  </ruby>
327
329
 
328
330
  h4. ActiveSupport::Cache::EhcacheStore
@@ -330,7 +332,7 @@ h4. ActiveSupport::Cache::EhcacheStore
330
332
  If you are using JRuby you can use Terracotta's Ehcache as the cache store for your application. Ehcache is an open source Java cache that also offers an enterprise version with increased scalability, management, and commercial support. You must first install the jruby-ehcache-rails3 gem (version 1.1.0 or later) to use this cache store.
331
333
 
332
334
  <ruby>
333
- ActionController::Base.cache_store = :ehcache_store
335
+ config.cache_store = :ehcache_store
334
336
  </ruby>
335
337
 
336
338
  When initializing the cache, you may use the +:ehcache_config+ option to specify the Ehcache config file to use (where the default is "ehcache.xml" in your Rails config directory), and the :cache_name option to provide a custom name for your cache (the default is rails_cache).
@@ -359,7 +361,7 @@ h4. ActiveSupport::Cache::NullStore
359
361
  This cache store implementation is meant to be used only in development or test environments and it never stores anything. This can be very useful in development when you have code that interacts directly with +Rails.cache+, but caching may interfere with being able to see the results of code changes. With this cache store, all +fetch+ and +read+ operations will result in a miss.
360
362
 
361
363
  <ruby>
362
- ActionController::Base.cache_store = :null
364
+ config.cache_store = :null_store
363
365
  </ruby>
364
366
 
365
367
  h4. Custom Cache Stores
@@ -369,7 +371,7 @@ You can create your own custom cache store by simply extending +ActiveSupport::C
369
371
  To use a custom cache store, simple set the cache store to a new instance of the class.
370
372
 
371
373
  <ruby>
372
- ActionController::Base.cache_store = MyCacheStore.new
374
+ config.cache_store = MyCacheStore.new
373
375
  </ruby>
374
376
 
375
377
  h4. Cache Keys
@@ -345,7 +345,7 @@ There are only a few configuration options for Action View, starting with three
345
345
  Proc.new { |html_tag, instance| %Q(<div class="field_with_errors">#{html_tag}</div>).html_safe }
346
346
  </ruby>
347
347
 
348
- * +config.action_view.default_form_builder+ tells Rails which form builder to use by default. The default is +ActionView::Helpers::FormBuilder+.
348
+ * +config.action_view.default_form_builder+ tells Rails which form builder to use by default. The default is +ActionView::Helpers::FormBuilder+. If you want your form builder class to be loaded after initialization (so it's reloaded on each request in development), you can pass it as a +String+
349
349
 
350
350
  * +config.action_view.erb_trim_mode+ gives the trim mode to be used by ERB. It defaults to +'-'+. See the "ERB documentation":http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/ for more information.
351
351
 
@@ -42,7 +42,7 @@ h4. Install git
42
42
 
43
43
  Ruby on Rails uses git for source code control. The "git homepage":http://git-scm.com/ has installation instructions. There are a variety of resources on the net that will help you get familiar with git:
44
44
 
45
- * "Everyday Git":http://www.kernel.org/pub/software/scm/git/docs/everyday.html will teach you just enough about git to get by.
45
+ * "Everyday Git":http://schacon.github.com/git/everyday.html will teach you just enough about git to get by.
46
46
  * The "PeepCode screencast":https://peepcode.com/products/git on git ($9) is easier to follow.
47
47
  * "GitHub":http://help.github.com offers links to a variety of git resources.
48
48
  * "Pro Git":http://progit.org/book/ is an entire book about git with a Creative Commons license.
@@ -329,9 +329,41 @@ h4. Commit Your Changes
329
329
  When you're happy with the code on your computer, you need to commit the changes to git:
330
330
 
331
331
  <shell>
332
- $ git commit -a -m "Here is a commit message on what I changed in this commit"
332
+ $ git commit -a
333
333
  </shell>
334
334
 
335
+ At this point, your editor should be fired up and you can write a message for this commit. Well formatted and descriptive commit messages are extremely helpful for the others, especially when figuring out why given change was made, so please take the time to write it.
336
+
337
+ Good commit message should be formatted according to the following example:
338
+
339
+ <plain>
340
+ Short summary (ideally 50 characters or less)
341
+
342
+ More detailed description, if necessary. It should be wrapped to 72
343
+ characters. Try to be as descriptive as you can, even if you think that
344
+ the commit content is obvious, it may not be obvious to others. You
345
+ should add such description also if it's already present in bug tracker,
346
+ it should not be necessary to visit a webpage to check the history.
347
+
348
+ Description can have multiple paragraps and you can use code examples
349
+ inside, just indent it with 4 spaces:
350
+
351
+ class PostsController
352
+ def index
353
+ respond_with Post.limit(10)
354
+ end
355
+ end
356
+
357
+ You can also add bullet points:
358
+
359
+ - you can use dashes or asterisks
360
+
361
+ - also, try to indent next line of a point for readability, if it's too
362
+ long to fit in 72 characters
363
+ </plain>
364
+
365
+ TIP. Please squash your commits into a single commit when appropriate. This simplifies future cherry picks, and also keeps the git log clean.
366
+
335
367
  h4. Update master
336
368
 
337
369
  It’s pretty likely that other changes to master have happened while you were working. Go get them:
@@ -205,7 +205,7 @@ The debugger used by Rails, +ruby-debug+, comes as a gem. To install it, just ru
205
205
  $ sudo gem install ruby-debug
206
206
  </shell>
207
207
 
208
- TIP: If you are using Ruby 1.9, you can install a compatible version of +ruby-debug+ by running +sudo gem install ruby-debug19+
208
+ TIP: If you are using Ruby 1.9, you can install a compatible version of +debugger+ by running +sudo gem install debugger+
209
209
 
210
210
  In case you want to download a particular version or get the source code, refer to the "project's page on rubyforge":http://rubyforge.org/projects/ruby-debug/.
211
211
 
@@ -10,7 +10,7 @@ you should be familiar with:
10
10
 
11
11
  endprologue.
12
12
 
13
- WARNING. This Guide is based on Rails 3.1. Some of the code shown here will not
13
+ WARNING. This Guide is based on Rails 3.2. Some of the code shown here will not
14
14
  work in earlier versions of Rails.
15
15
 
16
16
  h3. Guide Assumptions
@@ -23,9 +23,9 @@ prerequisites installed:
23
23
  * The "Ruby":http://www.ruby-lang.org/en/downloads language version 1.8.7 or higher
24
24
 
25
25
  TIP: Note that Ruby 1.8.7 p248 and p249 have marshaling bugs that crash Rails
26
- 3.0. Ruby Enterprise Edition have these fixed since release 1.8.7-2010.02
26
+ 3.0 and above. Ruby Enterprise Edition have these fixed since release 1.8.7-2010.02
27
27
  though. On the 1.9 front, Ruby 1.9.1 is not usable because it outright segfaults
28
- on Rails 3.0, so if you want to use Rails 3 with 1.9.x jump on 1.9.2 for smooth
28
+ on Rails 3.0 and above, so if you want to use Rails 3.0 or above with 1.9.x jump on 1.9.2 for smooth
29
29
  sailing.
30
30
 
31
31
  * The "RubyGems":http://rubyforge.org/frs/?group_id=126 packaging system
@@ -248,7 +248,7 @@ the following:
248
248
  $ rails --version
249
249
  </shell>
250
250
 
251
- If it says something like "Rails 3.1.3" you are ready to continue.
251
+ If it says something like "Rails 3.2.3" you are ready to continue.
252
252
 
253
253
  h4. Creating the Blog Application
254
254
 
@@ -685,6 +685,7 @@ The model file, +app/models/post.rb+ is about as simple as it can get:
685
685
 
686
686
  <ruby>
687
687
  class Post < ActiveRecord::Base
688
+ attr_accessible :content, :name, :title
688
689
  end
689
690
  </ruby>
690
691
 
@@ -692,7 +693,9 @@ There isn't much to this file - but note that the +Post+ class inherits from
692
693
  +ActiveRecord::Base+. Active Record supplies a great deal of functionality to
693
694
  your Rails models for free, including basic database CRUD (Create, Read, Update,
694
695
  Destroy) operations, data validation, as well as sophisticated search support
695
- and the ability to relate multiple models to one another.
696
+ and the ability to relate multiple models to one another. Another important part
697
+ of this file is +attr_accessible+. It specifies a whitelist of attributes that are
698
+ allowed to be updated in bulk (via +update_attributes+ for instance).
696
699
 
697
700
  h4. Adding Some Validation
698
701
 
@@ -701,6 +704,8 @@ Open the +app/models/post.rb+ file and edit it:
701
704
 
702
705
  <ruby>
703
706
  class Post < ActiveRecord::Base
707
+ attr_accessible :content, :name, :title
708
+
704
709
  validates :name, :presence => true
705
710
  validates :title, :presence => true,
706
711
  :length => { :minimum => 5 }
@@ -1218,6 +1223,8 @@ You'll need to edit the +post.rb+ file to add the other side of the association:
1218
1223
 
1219
1224
  <ruby>
1220
1225
  class Post < ActiveRecord::Base
1226
+ attr_accessible :content, :name, :title
1227
+
1221
1228
  validates :name, :presence => true
1222
1229
  validates :title, :presence => true,
1223
1230
  :length => { :minimum => 5 }
@@ -1605,6 +1612,8 @@ model, +app/models/post.rb+, as follows:
1605
1612
 
1606
1613
  <ruby>
1607
1614
  class Post < ActiveRecord::Base
1615
+ attr_accessible :content, :name, :title
1616
+
1608
1617
  validates :name, :presence => true
1609
1618
  validates :title, :presence => true,
1610
1619
  :length => { :minimum => 5 }
@@ -1686,6 +1695,8 @@ edit tags via posts:
1686
1695
 
1687
1696
  <ruby>
1688
1697
  class Post < ActiveRecord::Base
1698
+ attr_accessible :content, :name, :title, :tags_attributes
1699
+
1689
1700
  validates :name, :presence => true
1690
1701
  validates :title, :presence => true,
1691
1702
  :length => { :minimum => 5 }
@@ -1703,6 +1714,10 @@ nested attributes (you'll handle that by displaying a "remove" checkbox on the
1703
1714
  view that you'll build shortly). The +:reject_if+ option prevents saving new
1704
1715
  tags that do not have any attributes filled in.
1705
1716
 
1717
+ Also note we had to add +:tags_attributes+ to the +attr_accessible+ list. If
1718
+ we didn't do this there would be a +MassAssignmentSecurity+ exception when we try to
1719
+ update tags through our posts model.
1720
+
1706
1721
  We will modify +views/posts/_form.html.erb+ to render a partial to make a tag:
1707
1722
 
1708
1723
  <erb>
@@ -188,7 +188,7 @@ module Rails
188
188
  end
189
189
 
190
190
  all = (railties.all - order)
191
- all.push(self) unless all.include?(self)
191
+ all.push(self) unless (all + order).include?(self)
192
192
  order.push(:all) unless order.include?(:all)
193
193
 
194
194
  index = order.index(:all)
@@ -64,9 +64,13 @@ when 'application', 'runner'
64
64
  require "rails/commands/#{command}"
65
65
 
66
66
  when 'new'
67
- puts "Can't initialize a new Rails application within the directory of another, please change to a non-Rails directory first.\n"
68
- puts "Type 'rails' for help."
69
- exit(1)
67
+ if ARGV.first.in?(['-h', '--help'])
68
+ require 'rails/commands/application'
69
+ else
70
+ puts "Can't initialize a new Rails application within the directory of another, please change to a non-Rails directory first.\n"
71
+ puts "Type 'rails' for help."
72
+ exit(1)
73
+ end
70
74
 
71
75
  when '--version', '-v'
72
76
  ARGV.unshift '--version'
@@ -34,6 +34,10 @@ The common rails commands available for engines are:
34
34
  destroy Undo code generated with "generate" (short-cut alias: "d")
35
35
 
36
36
  All commands can be run with -h for more information.
37
+
38
+ If you want to run any commands that need to be run in context
39
+ of the application, like `rails server` or `rails console`,
40
+ you should do it from application's directory (typically test/dummy).
37
41
  EOT
38
42
  exit(1)
39
43
  end
@@ -57,6 +57,7 @@ module Rails
57
57
  :orm => false,
58
58
  :performance_tool => nil,
59
59
  :resource_controller => :controller,
60
+ :resource_route => true,
60
61
  :scaffold_controller => :scaffold_controller,
61
62
  :stylesheets => true,
62
63
  :stylesheet_engine => :css,
@@ -182,6 +183,7 @@ module Rails
182
183
 
183
184
  [
184
185
  "rails",
186
+ "resource_route",
185
187
  "#{orm}:migration",
186
188
  "#{orm}:model",
187
189
  "#{orm}:observer",
@@ -139,13 +139,13 @@ module Rails
139
139
  <<-GEMFILE.strip_heredoc
140
140
  gem 'rails', :path => '#{Rails::Generators::RAILS_DEV_PATH}'
141
141
  gem 'journey', :git => 'git://github.com/rails/journey.git'
142
- gem 'arel', :git => 'git://github.com/rails/arel.git'
142
+ gem 'arel', :git => 'git://github.com/rails/arel.git', :branch => '3-0-stable'
143
143
  GEMFILE
144
144
  elsif options.edge?
145
145
  <<-GEMFILE.strip_heredoc
146
146
  gem 'rails', :git => 'git://github.com/rails/rails.git', :branch => '3-2-stable'
147
147
  gem 'journey', :git => 'git://github.com/rails/journey.git'
148
- gem 'arel', :git => 'git://github.com/rails/arel.git'
148
+ gem 'arel', :git => 'git://github.com/rails/arel.git', :branch => '3-0-stable'
149
149
  GEMFILE
150
150
  else
151
151
  <<-GEMFILE.strip_heredoc
@@ -188,7 +188,7 @@ module Rails
188
188
  if RUBY_VERSION < "1.9"
189
189
  "gem 'ruby-debug'"
190
190
  else
191
- "gem 'ruby-debug19', :require => 'ruby-debug'"
191
+ "gem 'debugger'"
192
192
  end
193
193
  end
194
194
 
@@ -31,10 +31,9 @@ module Rails
31
31
  # root otherwise uses a default description.
32
32
  def self.desc(description=nil)
33
33
  return super if description
34
- usage = source_root && File.expand_path("../USAGE", source_root)
35
34
 
36
- @desc ||= if usage && File.exist?(usage)
37
- ERB.new(File.read(usage)).result(binding)
35
+ @desc ||= if usage_path
36
+ ERB.new(File.read(usage_path)).result(binding)
38
37
  else
39
38
  "Description:\n Create #{base_name.humanize.downcase} files for #{generator_name} generator."
40
39
  end
@@ -207,7 +206,8 @@ module Rails
207
206
  # root, you should use source_root.
208
207
  def self.default_source_root
209
208
  return unless base_name && generator_name
210
- path = File.expand_path(File.join(base_name, generator_name, 'templates'), base_root)
209
+ return unless default_generator_root
210
+ path = File.join(default_generator_root, 'templates')
211
211
  path if File.exists?(path)
212
212
  end
213
213
 
@@ -371,6 +371,19 @@ module Rails
371
371
  }
372
372
  end
373
373
 
374
+ def self.usage_path
375
+ paths = [
376
+ source_root && File.expand_path("../USAGE", source_root),
377
+ default_generator_root && File.join(default_generator_root, "USAGE")
378
+ ]
379
+ paths.compact.detect { |path| File.exists? path }
380
+ end
381
+
382
+ def self.default_generator_root
383
+ path = File.expand_path(File.join(base_name, generator_name), base_root)
384
+ path if File.exists?(path)
385
+ end
386
+
374
387
  end
375
388
  end
376
389
  end
@@ -82,6 +82,10 @@ module Rails
82
82
  @class_path
83
83
  end
84
84
 
85
+ def namespaced_file_path
86
+ @namespaced_file_path ||= namespaced_class_path.join("/")
87
+ end
88
+
85
89
  def namespaced_class_path
86
90
  @namespaced_class_path ||= begin
87
91
  namespace_path = namespace.name.split("::").map {|m| m.underscore }
@@ -10,4 +10,4 @@
10
10
  *
11
11
  *= require_self
12
12
  *= require_tree .
13
- */
13
+ */
@@ -49,6 +49,9 @@ module <%= app_const_base %>
49
49
  # Configure sensitive parameters which will be filtered from the log file.
50
50
  config.filter_parameters += [:password]
51
51
 
52
+ # Enable escaping HTML in JSON.
53
+ config.active_support.escape_html_entities_in_json = true
54
+
52
55
  # Use SQL instead of Active Record's schema dumper when creating the database.
53
56
  # This is necessary if your schema can't be completely dumped by the schema dumper,
54
57
  # like if you have constraints or database-specific column types
@@ -21,7 +21,7 @@
21
21
  # Generate digests for assets URLs
22
22
  config.assets.digest = true
23
23
 
24
- # Defaults to Rails.root.join("public/assets")
24
+ # Defaults to nil and saved in location specified by config.assets.prefix
25
25
  # config.assets.manifest = YOUR_PATH
26
26
  <%- end -%>
27
27
 
@@ -1,3 +1,7 @@
1
+ <% if namespaced? -%>
2
+ require_dependency "<%= namespaced_file_path %>/application_controller"
3
+ <% end -%>
4
+
1
5
  <% module_namespacing do -%>
2
6
  class <%= class_name %>Controller < ApplicationController
3
7
  <% actions.each do |action| -%>
@@ -14,13 +14,7 @@ module Rails
14
14
  class_option :actions, :type => :array, :banner => "ACTION ACTION", :default => [],
15
15
  :desc => "Actions for the resource controller"
16
16
 
17
- def add_resource_route
18
- return if options[:actions].present?
19
- route_config = regular_class_path.collect{|namespace| "namespace :#{namespace} do " }.join(" ")
20
- route_config << "resources :#{file_name.pluralize}"
21
- route_config << " end" * regular_class_path.size
22
- route route_config
23
- end
17
+ hook_for :resource_route, :required => true
24
18
  end
25
19
  end
26
20
  end
@@ -0,0 +1,13 @@
1
+ module Rails
2
+ module Generators
3
+ class ResourceRouteGenerator < NamedBase
4
+ def add_resource_route
5
+ return if options[:actions].present?
6
+ route_config = regular_class_path.collect{ |namespace| "namespace :#{namespace} do " }.join(" ")
7
+ route_config << "resources :#{file_name.pluralize}"
8
+ route_config << " end" * regular_class_path.size
9
+ route route_config
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,7 @@
1
+ <% if namespaced? -%>
2
+ require_dependency "<%= namespaced_file_path %>/application_controller"
3
+ <% end -%>
4
+
1
5
  <% module_namespacing do -%>
2
6
  class <%= controller_class_name %>Controller < ApplicationController
3
7
  # GET <%= route_url %>
@@ -135,7 +135,7 @@ module Rails
135
135
  # Asserts a given migration does not exist. You need to supply an absolute path or a
136
136
  # path relative to the configured destination:
137
137
  #
138
- # assert_no_file "config/random.rb"
138
+ # assert_no_migration "db/migrate/create_products.rb"
139
139
  #
140
140
  def assert_no_migration(relative)
141
141
  file_name = migration_file_name(relative)
@@ -182,7 +182,7 @@ module Rails
182
182
 
183
183
  # Asserts the given attribute type gets a proper default value:
184
184
  #
185
- # assert_field_type :string, "MyString"
185
+ # assert_field_default_value :string, "MyString"
186
186
  #
187
187
  def assert_field_default_value(attribute_type, value)
188
188
  assert_equal(value, create_generated_attribute(attribute_type).default)
@@ -4,10 +4,13 @@ module Rails
4
4
  def initialize(app, log = nil)
5
5
  @app = app
6
6
 
7
- path = Pathname.new(log || "#{File.expand_path(Rails.root)}/log/#{Rails.env}.log").cleanpath
8
- @cursor = ::File.size(path)
7
+ path = Pathname.new(log || "#{::File.expand_path(Rails.root)}/log/#{Rails.env}.log").cleanpath
9
8
 
10
- @file = ::File.open(path, 'r')
9
+ @cursor = @file = nil
10
+ if ::File.exists?(path)
11
+ @cursor = ::File.size(path)
12
+ @file = ::File.open(path, 'r')
13
+ end
11
14
  end
12
15
 
13
16
  def call(env)
@@ -17,6 +20,7 @@ module Rails
17
20
  end
18
21
 
19
22
  def tail!
23
+ return unless @cursor
20
24
  @file.seek @cursor
21
25
 
22
26
  unless @file.eof?
@@ -8,7 +8,7 @@ end
8
8
 
9
9
  # Monkey-patch to remove redoc'ing and clobber descriptions to cut down on rake -T noise
10
10
  class RDocTaskWithoutDescriptions < RDoc::Task
11
- include ::Rake::DSL
11
+ include ::Rake::DSL if defined?(::Rake::DSL)
12
12
 
13
13
  def define
14
14
  task rdoc_task_name
@@ -2,8 +2,8 @@ module Rails
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 2
5
- TINY = 3
6
- PRE = nil
5
+ TINY = 4
6
+ PRE = "rc1"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
9
9
  end
metadata CHANGED
@@ -1,13 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railties
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
5
- prerelease: false
4
+ hash: 1750708067
5
+ prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 2
9
- - 3
10
- version: 3.2.3
9
+ - 4
10
+ - rc
11
+ - 1
12
+ version: 3.2.4.rc1
11
13
  platform: ruby
12
14
  authors:
13
15
  - David Heinemeier Hansson
@@ -15,11 +17,12 @@ autorequire:
15
17
  bindir: bin
16
18
  cert_chain: []
17
19
 
18
- date: 2012-03-30 00:00:00 -03:00
19
- default_executable:
20
+ date: 2012-05-28 00:00:00 Z
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
23
+ name: rake
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
23
26
  none: false
24
27
  requirements:
25
28
  - - ">="
@@ -30,44 +33,51 @@ dependencies:
30
33
  - 8
31
34
  - 7
32
35
  version: 0.8.7
33
- requirement: *id001
34
36
  type: :runtime
35
- name: rake
36
- prerelease: false
37
+ version_requirements: *id001
37
38
  - !ruby/object:Gem::Dependency
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
39
+ name: rack-ssl
40
+ prerelease: false
41
+ requirement: &id002 !ruby/object:Gem::Requirement
39
42
  none: false
40
43
  requirements:
41
44
  - - ~>
42
45
  - !ruby/object:Gem::Version
43
- hash: 43
46
+ hash: 31
44
47
  segments:
45
- - 0
46
- - 14
47
- - 6
48
- version: 0.14.6
49
- requirement: *id002
48
+ - 1
49
+ - 3
50
+ - 2
51
+ version: 1.3.2
50
52
  type: :runtime
53
+ version_requirements: *id002
54
+ - !ruby/object:Gem::Dependency
51
55
  name: thor
52
56
  prerelease: false
53
- - !ruby/object:Gem::Dependency
54
- version_requirements: &id003 !ruby/object:Gem::Requirement
57
+ requirement: &id003 !ruby/object:Gem::Requirement
55
58
  none: false
56
59
  requirements:
57
- - - ~>
60
+ - - ">="
58
61
  - !ruby/object:Gem::Version
59
- hash: 31
62
+ hash: 43
63
+ segments:
64
+ - 0
65
+ - 14
66
+ - 6
67
+ version: 0.14.6
68
+ - - <
69
+ - !ruby/object:Gem::Version
70
+ hash: 3
60
71
  segments:
61
- - 1
62
- - 3
63
72
  - 2
64
- version: 1.3.2
65
- requirement: *id003
73
+ - 0
74
+ version: "2.0"
66
75
  type: :runtime
67
- name: rack-ssl
68
- prerelease: false
76
+ version_requirements: *id003
69
77
  - !ruby/object:Gem::Dependency
70
- version_requirements: &id004 !ruby/object:Gem::Requirement
78
+ name: rdoc
79
+ prerelease: false
80
+ requirement: &id004 !ruby/object:Gem::Requirement
71
81
  none: false
72
82
  requirements:
73
83
  - - ~>
@@ -77,42 +87,44 @@ dependencies:
77
87
  - 3
78
88
  - 4
79
89
  version: "3.4"
80
- requirement: *id004
81
90
  type: :runtime
82
- name: rdoc
83
- prerelease: false
91
+ version_requirements: *id004
84
92
  - !ruby/object:Gem::Dependency
85
- version_requirements: &id005 !ruby/object:Gem::Requirement
93
+ name: activesupport
94
+ prerelease: false
95
+ requirement: &id005 !ruby/object:Gem::Requirement
86
96
  none: false
87
97
  requirements:
88
98
  - - "="
89
99
  - !ruby/object:Gem::Version
90
- hash: 9
100
+ hash: 1750708067
91
101
  segments:
92
102
  - 3
93
103
  - 2
94
- - 3
95
- version: 3.2.3
96
- requirement: *id005
104
+ - 4
105
+ - rc
106
+ - 1
107
+ version: 3.2.4.rc1
97
108
  type: :runtime
98
- name: activesupport
99
- prerelease: false
109
+ version_requirements: *id005
100
110
  - !ruby/object:Gem::Dependency
101
- version_requirements: &id006 !ruby/object:Gem::Requirement
111
+ name: actionpack
112
+ prerelease: false
113
+ requirement: &id006 !ruby/object:Gem::Requirement
102
114
  none: false
103
115
  requirements:
104
116
  - - "="
105
117
  - !ruby/object:Gem::Version
106
- hash: 9
118
+ hash: 1750708067
107
119
  segments:
108
120
  - 3
109
121
  - 2
110
- - 3
111
- version: 3.2.3
112
- requirement: *id006
122
+ - 4
123
+ - rc
124
+ - 1
125
+ version: 3.2.4.rc1
113
126
  type: :runtime
114
- name: actionpack
115
- prerelease: false
127
+ version_requirements: *id006
116
128
  description: "Rails internals: application bootup, plugins, generators, and rake tasks."
117
129
  email: david@loudthinking.com
118
130
  executables:
@@ -535,6 +547,7 @@ files:
535
547
  - lib/rails/generators/rails/plugin_new/USAGE
536
548
  - lib/rails/generators/rails/resource/resource_generator.rb
537
549
  - lib/rails/generators/rails/resource/USAGE
550
+ - lib/rails/generators/rails/resource_route/resource_route_generator.rb
538
551
  - lib/rails/generators/rails/scaffold/scaffold_generator.rb
539
552
  - lib/rails/generators/rails/scaffold/templates/scaffold.css
540
553
  - lib/rails/generators/rails/scaffold/USAGE
@@ -614,7 +627,6 @@ files:
614
627
  - lib/rails/generators/rails/generator/templates/templates/.empty_directory
615
628
  - lib/rails/generators/rails/plugin_new/templates/app/mailers/.empty_directory
616
629
  - lib/rails/generators/rails/plugin_new/templates/app/models/.empty_directory
617
- has_rdoc: true
618
630
  homepage: http://www.rubyonrails.org
619
631
  licenses: []
620
632
 
@@ -638,16 +650,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
638
650
  required_rubygems_version: !ruby/object:Gem::Requirement
639
651
  none: false
640
652
  requirements:
641
- - - ">="
653
+ - - ">"
642
654
  - !ruby/object:Gem::Version
643
- hash: 3
655
+ hash: 25
644
656
  segments:
645
- - 0
646
- version: "0"
657
+ - 1
658
+ - 3
659
+ - 1
660
+ version: 1.3.1
647
661
  requirements: []
648
662
 
649
663
  rubyforge_project:
650
- rubygems_version: 1.3.7
664
+ rubygems_version: 1.8.22
651
665
  signing_key:
652
666
  specification_version: 3
653
667
  summary: Tools for creating, working with, and running Rails applications.