railties 3.2.2 → 3.2.3.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,13 @@
1
+ ## Rails 3.2.3 (unreleased) ##
2
+
3
+ * No changes.
4
+
5
+
6
+ ## Rails 3.2.2 (March 1, 2012) ##
7
+
8
+ * No changes.
9
+
10
+
1
11
  ## Rails 3.2.1 (January 26, 2012) ##
2
12
 
3
13
  * Documentation fixes.
@@ -46,7 +56,19 @@
46
56
  * Remove old 'config.paths.app.controller' API in favor of 'config.paths["app/controller"]' API *Guillermo Iguaran*
47
57
 
48
58
 
49
- * Rails 3.1.1
59
+ ## Rails 3.1.2 (November 18, 2011) ##
60
+
61
+ * Engines: don't blow up if db/seeds.rb is missing.
62
+
63
+ *Jeremy Kemper*
64
+
65
+ * `rails new foo --skip-test-unit` should not add the `:test` task to the rake default task.
66
+ *GH 2564*
67
+
68
+ *José Valim*
69
+
70
+
71
+ ## Rails 3.1.1 (October 7, 2011) ##
50
72
 
51
73
  * Add jquery-rails to Gemfile of plugins, test/dummy app needs it. Closes #3091. *Santiago Pastorino*
52
74
 
@@ -59,16 +81,6 @@
59
81
  Plugins developers need to special case their initializers that are
60
82
  meant to be run in the assets group by adding :group => :assets.
61
83
 
62
- ## Rails 3.1.2 (unreleased) ##
63
-
64
- * Engines: don't blow up if db/seeds.rb is missing.
65
-
66
- *Jeremy Kemper*
67
-
68
- * `rails new foo --skip-test-unit` should not add the `:test` task to the rake default task.
69
- *GH 2564*
70
-
71
- *José Valim*
72
84
 
73
85
  ## Rails 3.1.0 (August 30, 2011) ##
74
86
 
@@ -12,5 +12,5 @@
12
12
  .syntaxhighlighter table thead,
13
13
  .syntaxhighlighter table caption,
14
14
  .syntaxhighlighter textarea {
15
- line-height: 1.2em !important;
15
+ line-height: 1.25em !important;
16
16
  }
@@ -94,7 +94,7 @@ client = Client.find(10)
94
94
  The SQL equivalent of the above is:
95
95
 
96
96
  <sql>
97
- SELECT * FROM clients WHERE (clients.id = 10)
97
+ SELECT * FROM clients WHERE (clients.id = 10) LIMIT 1
98
98
  </sql>
99
99
 
100
100
  <tt>Model.find(primary_key)</tt> will raise an +ActiveRecord::RecordNotFound+ exception if no matching record is found.
@@ -1109,6 +1109,8 @@ Client.where(:first_name => 'Andy').first_or_create!(:locked => false)
1109
1109
  # => ActiveRecord::RecordInvalid: Validation failed: Orders count can't be blank
1110
1110
  </ruby>
1111
1111
 
1112
+ As with +first_or_create+ there is a +find_or_create_by!+ method but the +first_or_create!+ method is preferred for clarity.
1113
+
1112
1114
  h4. +first_or_initialize+
1113
1115
 
1114
1116
  The +first_or_initialize+ method will work just like +first_or_create+ but it will not call +create+ but +new+. This means that a new model instance will be created in memory but won't be saved to the database. Continuing with the +first_or_create+ example, we now want the client named 'Nick':
@@ -128,7 +128,7 @@ For example, these files:
128
128
  <plain>
129
129
  app/assets/javascripts/home.js
130
130
  lib/assets/javascripts/moovinator.js
131
- vendor/assets/javascript/slider.js
131
+ vendor/assets/javascripts/slider.js
132
132
  </plain>
133
133
 
134
134
  would be referenced in a manifest like this:
@@ -1319,7 +1319,7 @@ If you need to evaluate conditions dynamically at runtime, use a proc:
1319
1319
  <ruby>
1320
1320
  class Customer < ActiveRecord::Base
1321
1321
  has_many :latest_orders, :class_name => "Order",
1322
- :conditions => proc { ["orders.created_at > ?, 10.hours.ago] }
1322
+ :conditions => proc { ["orders.created_at > ?", 10.hours.ago] }
1323
1323
  end
1324
1324
  </ruby>
1325
1325
 
@@ -337,7 +337,7 @@ h4. Configuring Action Dispatch
337
337
 
338
338
  h4. Configuring Action View
339
339
 
340
- There are only a few configuration options for Action View, starting with four on +ActionView::Base+:
340
+ There are only a few configuration options for Action View, starting with three on +ActionView::Base+:
341
341
 
342
342
  * +config.action_view.field_error_proc+ provides an HTML generator for displaying errors that come from Active Record. The default is
343
343
 
@@ -347,8 +347,6 @@ Proc.new { |html_tag, instance| %Q(<div class="field_with_errors">#{html_tag}</d
347
347
 
348
348
  * +config.action_view.default_form_builder+ tells Rails which form builder to use by default. The default is +ActionView::Helpers::FormBuilder+.
349
349
 
350
- * +config.action_view.logger+ accepts a logger conforming to the interface of Log4r or the default Ruby Logger class, which is then used to log information from Action Mailer. Set to +nil+ to disable logging.
351
-
352
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.
353
351
 
354
352
  * +config.action_view.javascript_expansions+ is a hash containing expansions that can be used for the JavaScript include tag. By default, this is defined as:
@@ -483,7 +481,7 @@ Rails has 5 initialization events which can be hooked into (listed in the order
483
481
 
484
482
  * +after_initialize+: Run directly after the initialization of the application, but before the application initializers are run.
485
483
 
486
- To define an event for these hooks, use the block syntax within a +Rails::Aplication+, +Rails::Railtie+ or +Rails::Engine+ subclass:
484
+ To define an event for these hooks, use the block syntax within a +Rails::Application+, +Rails::Railtie+ or +Rails::Engine+ subclass:
487
485
 
488
486
  <ruby>
489
487
  module YourApp
@@ -235,14 +235,14 @@ end
235
235
 
236
236
  In addition to the routes for magazines, this declaration will also route ads to an +AdsController+. The ad URLs require a magazine:
237
237
 
238
- |_.HTTP Verb |_.Path |_.action |_.used for |
239
- |GET |/magazines/:id/ads |index |display a list of all ads for a specific magazine |
240
- |GET |/magazines/:id/ads/new |new |return an HTML form for creating a new ad belonging to a specific magazine |
241
- |POST |/magazines/:id/ads |create |create a new ad belonging to a specific magazine |
242
- |GET |/magazines/:id/ads/:id |show |display a specific ad belonging to a specific magazine |
243
- |GET |/magazines/:id/ads/:id/edit |edit |return an HTML form for editing an ad belonging to a specific magazine |
244
- |PUT |/magazines/:id/ads/:id |update |update a specific ad belonging to a specific magazine |
245
- |DELETE |/magazines/:id/ads/:id |destroy |delete a specific ad belonging to a specific magazine |
238
+ |_.HTTP Verb |_.Path |_.action |_.used for |
239
+ |GET |/magazines/:magazine_id/ads |index |display a list of all ads for a specific magazine |
240
+ |GET |/magazines/:magazine_id/ads/new |new |return an HTML form for creating a new ad belonging to a specific magazine |
241
+ |POST |/magazines/:magazine_id/ads |create |create a new ad belonging to a specific magazine |
242
+ |GET |/magazines/:magazine_id/ads/:id |show |display a specific ad belonging to a specific magazine |
243
+ |GET |/magazines/:magazine_id/ads/:id/edit |edit |return an HTML form for editing an ad belonging to a specific magazine |
244
+ |PUT |/magazines/:magazine_id/ads/:id |update |update a specific ad belonging to a specific magazine |
245
+ |DELETE |/magazines/:magazine_id/ads/:id |destroy |delete a specific ad belonging to a specific magazine |
246
246
 
247
247
 
248
248
  This will also create routing helpers such as +magazine_ads_url+ and +edit_magazine_ad_path+. These helpers take an instance of Magazine as the first parameter (+magazine_ads_url(@magazine)+).
@@ -385,7 +385,7 @@ match ':controller/:action/:id/:user_id'
385
385
 
386
386
  An incoming path of +/photos/show/1/2+ will be dispatched to the +show+ action of the +PhotosController+. +params[:id]+ will be +"1"+, and +params[:user_id]+ will be +"2"+.
387
387
 
388
- NOTE: You can't use +namespace+ or +:module+ with a +:controller+ path segment. If you need to do this then use a constraint on :controller that matches the namespace you require. e.g:
388
+ NOTE: You can't use +:namespace+ or +:module+ with a +:controller+ path segment. If you need to do this then use a constraint on :controller that matches the namespace you require. e.g:
389
389
 
390
390
  <ruby>
391
391
  match ':controller(/:action(/:id))', :controller => /admin\/[^\/]+/
@@ -374,7 +374,7 @@ end
374
374
  Mass-assignment saves you much work, because you don't have to set each value individually. Simply pass a hash to the +new+ method, or +assign_attributes=+ a hash value, to set the model's attributes to the values in the hash. The problem is that it is often used in conjunction with the parameters (params) hash available in the controller, which may be manipulated by an attacker. He may do so by changing the URL like this:
375
375
 
376
376
  <pre>
377
- "name":http://www.example.com/user/signup?user[name]=ow3ned&user[admin]=1
377
+ http://www.example.com/user/signup?user[name]=ow3ned&user[admin]=1
378
378
  </pre>
379
379
 
380
380
  This will set the following parameters in the controller:
@@ -245,7 +245,7 @@ module Rails
245
245
  #
246
246
  # Additionally, an isolated engine will set its name according to namespace, so
247
247
  # MyEngine::Engine.engine_name will be "my_engine". It will also set MyEngine.table_name_prefix
248
- # to "my_engine_", changing the MyEngine::Article model to use the my_engine_article table.
248
+ # to "my_engine_", changing the MyEngine::Article model to use the my_engine_articles table.
249
249
  #
250
250
  # == Using Engine's routes outside Engine
251
251
  #
@@ -234,7 +234,7 @@ module Rails
234
234
  if defined?(JRUBY_VERSION)
235
235
  "gem 'therubyrhino'\n"
236
236
  else
237
- "# gem 'therubyracer'\n"
237
+ "# gem 'therubyracer', :platform => :ruby\n"
238
238
  end
239
239
  end
240
240
 
@@ -58,7 +58,7 @@ module <%= app_const_base %>
58
58
  # This will create an empty whitelist of attributes available for mass-assignment for all models
59
59
  # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
60
60
  # parameters by using an attr_accessible or attr_protected declaration.
61
- # config.active_record.whitelist_attributes = true
61
+ <%= comment_if :skip_active_record %>config.active_record.whitelist_attributes = true
62
62
 
63
63
  <% unless options.skip_sprockets? -%>
64
64
  # Enable the asset pipeline
@@ -8,3 +8,8 @@ Rails.backtrace_cleaner.remove_silencers!
8
8
 
9
9
  # Load support files
10
10
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
+
12
+ # Load fixtures from the engine
13
+ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
14
+ ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
15
+ end
@@ -8,10 +8,31 @@ module TestUnit
8
8
 
9
9
  check_class_collision :suffix => "ControllerTest"
10
10
 
11
+ argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
12
+
11
13
  def create_test_files
12
14
  template 'functional_test.rb',
13
15
  File.join('test/functional', controller_class_path, "#{controller_file_name}_controller_test.rb")
14
16
  end
17
+
18
+ private
19
+
20
+ def resource_attributes
21
+ key_value singular_table_name, "{ #{attributes_hash} }"
22
+ end
23
+
24
+ def attributes_hash
25
+ return if accessible_attributes.empty?
26
+
27
+ accessible_attributes.map do |a|
28
+ name = a.name
29
+ key_value name, "@#{singular_table_name}.#{name}"
30
+ end.sort.join(', ')
31
+ end
32
+
33
+ def accessible_attributes
34
+ attributes.reject(&:reference?)
35
+ end
15
36
  end
16
37
  end
17
38
  end
@@ -19,7 +19,7 @@ class <%= controller_class_name %>ControllerTest < ActionController::TestCase
19
19
 
20
20
  test "should create <%= singular_table_name %>" do
21
21
  assert_difference('<%= class_name %>.count') do
22
- post :create, <%= key_value singular_table_name, "@#{singular_table_name}.attributes" %>
22
+ post :create, <%= resource_attributes %>
23
23
  end
24
24
 
25
25
  assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>))
@@ -36,7 +36,7 @@ class <%= controller_class_name %>ControllerTest < ActionController::TestCase
36
36
  end
37
37
 
38
38
  test "should update <%= singular_table_name %>" do
39
- put :update, <%= key_value :id, "@#{singular_table_name}" %>, <%= key_value singular_table_name, "@#{singular_table_name}.attributes" %>
39
+ put :update, <%= key_value :id, "@#{singular_table_name}" %>, <%= resource_attributes %>
40
40
  assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>))
41
41
  end
42
42
 
@@ -157,7 +157,25 @@ module Rails
157
157
  path = File.expand_path(p, @root.path)
158
158
 
159
159
  if @glob
160
- result.concat Dir[File.join(path, @glob)].sort
160
+ if File.directory? path
161
+ result.concat expand_dir(path, @glob)
162
+ else
163
+ # FIXME: I think we can remove this branch, but I'm not sure.
164
+ # Say the filesystem has this file:
165
+ #
166
+ # /tmp/foobar
167
+ #
168
+ # and someone adds this path:
169
+ #
170
+ # /tmp/foo
171
+ #
172
+ # with a glob of "*", then this function will return
173
+ #
174
+ # /tmp/foobar
175
+ #
176
+ # We need to figure out if that is desired behavior.
177
+ result.concat expand_file(path, @glob)
178
+ end
161
179
  else
162
180
  result << path
163
181
  end
@@ -177,6 +195,17 @@ module Rails
177
195
  end
178
196
 
179
197
  alias to_a expanded
198
+
199
+ private
200
+ def expand_file(path, glob)
201
+ Dir[File.join(path, glob)].sort
202
+ end
203
+
204
+ def expand_dir(path, glob)
205
+ Dir.chdir(path) do
206
+ Dir.glob(@glob).map { |file| File.join path, file }.sort
207
+ end
208
+ end
180
209
  end
181
210
  end
182
211
  end
@@ -2,8 +2,8 @@ module Rails
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 2
5
- TINY = 2
6
- PRE = nil
5
+ TINY = 3
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: 11
5
- prerelease:
4
+ hash: 15424079
5
+ prerelease: true
6
6
  segments:
7
7
  - 3
8
8
  - 2
9
- - 2
10
- version: 3.2.2
9
+ - 3
10
+ - rc
11
+ - 1
12
+ version: 3.2.3.rc1
11
13
  platform: ruby
12
14
  authors:
13
15
  - David Heinemeier Hansson
@@ -15,12 +17,11 @@ autorequire:
15
17
  bindir: bin
16
18
  cert_chain: []
17
19
 
18
- date: 2012-03-01 00:00:00 Z
20
+ date: 2012-03-27 00:00:00 -03:00
21
+ default_executable:
19
22
  dependencies:
20
23
  - !ruby/object:Gem::Dependency
21
- name: rake
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
+ version_requirements: &id001 !ruby/object:Gem::Requirement
24
25
  none: false
25
26
  requirements:
26
27
  - - ">="
@@ -31,12 +32,12 @@ dependencies:
31
32
  - 8
32
33
  - 7
33
34
  version: 0.8.7
35
+ requirement: *id001
34
36
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: thor
37
+ name: rake
38
38
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
39
+ - !ruby/object:Gem::Dependency
40
+ version_requirements: &id002 !ruby/object:Gem::Requirement
40
41
  none: false
41
42
  requirements:
42
43
  - - ~>
@@ -47,12 +48,12 @@ dependencies:
47
48
  - 14
48
49
  - 6
49
50
  version: 0.14.6
51
+ requirement: *id002
50
52
  type: :runtime
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: rack-ssl
53
+ name: thor
54
54
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
55
+ - !ruby/object:Gem::Dependency
56
+ version_requirements: &id003 !ruby/object:Gem::Requirement
56
57
  none: false
57
58
  requirements:
58
59
  - - ~>
@@ -63,12 +64,12 @@ dependencies:
63
64
  - 3
64
65
  - 2
65
66
  version: 1.3.2
67
+ requirement: *id003
66
68
  type: :runtime
67
- version_requirements: *id003
68
- - !ruby/object:Gem::Dependency
69
- name: rdoc
69
+ name: rack-ssl
70
70
  prerelease: false
71
- requirement: &id004 !ruby/object:Gem::Requirement
71
+ - !ruby/object:Gem::Dependency
72
+ version_requirements: &id004 !ruby/object:Gem::Requirement
72
73
  none: false
73
74
  requirements:
74
75
  - - ~>
@@ -78,40 +79,46 @@ dependencies:
78
79
  - 3
79
80
  - 4
80
81
  version: "3.4"
82
+ requirement: *id004
81
83
  type: :runtime
82
- version_requirements: *id004
83
- - !ruby/object:Gem::Dependency
84
- name: activesupport
84
+ name: rdoc
85
85
  prerelease: false
86
- requirement: &id005 !ruby/object:Gem::Requirement
86
+ - !ruby/object:Gem::Dependency
87
+ version_requirements: &id005 !ruby/object:Gem::Requirement
87
88
  none: false
88
89
  requirements:
89
90
  - - "="
90
91
  - !ruby/object:Gem::Version
91
- hash: 11
92
+ hash: 15424079
92
93
  segments:
93
94
  - 3
94
95
  - 2
95
- - 2
96
- version: 3.2.2
96
+ - 3
97
+ - rc
98
+ - 1
99
+ version: 3.2.3.rc1
100
+ requirement: *id005
97
101
  type: :runtime
98
- version_requirements: *id005
99
- - !ruby/object:Gem::Dependency
100
- name: actionpack
102
+ name: activesupport
101
103
  prerelease: false
102
- requirement: &id006 !ruby/object:Gem::Requirement
104
+ - !ruby/object:Gem::Dependency
105
+ version_requirements: &id006 !ruby/object:Gem::Requirement
103
106
  none: false
104
107
  requirements:
105
108
  - - "="
106
109
  - !ruby/object:Gem::Version
107
- hash: 11
110
+ hash: 15424079
108
111
  segments:
109
112
  - 3
110
113
  - 2
111
- - 2
112
- version: 3.2.2
114
+ - 3
115
+ - rc
116
+ - 1
117
+ version: 3.2.3.rc1
118
+ requirement: *id006
113
119
  type: :runtime
114
- version_requirements: *id006
120
+ name: actionpack
121
+ prerelease: false
115
122
  description: "Rails internals: application bootup, plugins, generators, and rake tasks."
116
123
  email: david@loudthinking.com
117
124
  executables:
@@ -613,6 +620,7 @@ files:
613
620
  - lib/rails/generators/rails/generator/templates/templates/.empty_directory
614
621
  - lib/rails/generators/rails/plugin_new/templates/app/mailers/.empty_directory
615
622
  - lib/rails/generators/rails/plugin_new/templates/app/models/.empty_directory
623
+ has_rdoc: true
616
624
  homepage: http://www.rubyonrails.org
617
625
  licenses: []
618
626
 
@@ -636,16 +644,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
636
644
  required_rubygems_version: !ruby/object:Gem::Requirement
637
645
  none: false
638
646
  requirements:
639
- - - ">="
647
+ - - ">"
640
648
  - !ruby/object:Gem::Version
641
- hash: 3
649
+ hash: 25
642
650
  segments:
643
- - 0
644
- version: "0"
651
+ - 1
652
+ - 3
653
+ - 1
654
+ version: 1.3.1
645
655
  requirements: []
646
656
 
647
657
  rubyforge_project:
648
- rubygems_version: 1.8.16
658
+ rubygems_version: 1.3.7
649
659
  signing_key:
650
660
  specification_version: 3
651
661
  summary: Tools for creating, working with, and running Rails applications.