actionpack 1.8.0 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionpack might be problematic. Click here for more details.

data/CHANGELOG CHANGED
@@ -1,3 +1,20 @@
1
+ *1.8.1* (20th April, 2005)
2
+
3
+ * Added xml_http_request/xhr method for simulating XMLHttpRequest in functional tests #1151 [Sam Stephenson]. Example:
4
+
5
+ xhr :post, :index
6
+
7
+ * Fixed that Ajax.Base.options.asynchronous wasn't being respected in Ajax.Request (thanks Jon Casey)
8
+
9
+ * Fixed that :get, :post, and the others should take a flash array as the third argument just like process #1144 [rails@cogentdude.com]
10
+
11
+ * Fixed a problem with Flash.now
12
+
13
+ * Fixed stringification on all assigned hashes. The sacrifice is that assigns[:person] won't work in testing. Instead assigns["person"] or assigns(:person) must be used. In other words, the keys of assigns stay strings but we've added a method-based accessor to appease the need for symbols.
14
+
15
+ * Fixed that rendering a template would require a connection to the database #1146
16
+
17
+
1
18
  *1.8.0* (19th April, 2005)
2
19
 
3
20
  * Added assert_tag and assert_no_tag as a much improved alternative to the deprecated assert_template_xpath_match #1126 [Jamis Buck]
@@ -36,7 +53,7 @@
36
53
 
37
54
  * Fixed that you can now pass an alternative :href option to link_to_function/remote in order to point to somewhere other than # if the javascript fails or is turned off. You can do the same with form_remote_tag by passing in :action. #1113 [Sam Stephenson]
38
55
 
39
- * Fixed DateHelper to return values on the option tags such that they'll work properly in IE with form_remote_tag #1024 [rscottmace@gmail.com]
56
+ * Fixed DateHelper to return values on the option tags such that they'll work properly in IE with form_remote_tag #1024 [Scott Raymond]
40
57
 
41
58
  * Fixed FormTagHelper#check_box to respect checked #1049 [DelynnB]
42
59
 
@@ -14,10 +14,14 @@ module Test #:nodoc:
14
14
  #
15
15
  # These collections can be used just like any other hash:
16
16
  #
17
- # assert_not_nil assigns[:person] # makes sure that a @person instance variable was set
17
+ # assert_not_nil assigns(:person) # makes sure that a @person instance variable was set
18
18
  # assert_equal "Dave", cookies[:name] # makes sure that a cookie called :name was set as "Dave"
19
19
  # assert flash.empty? # makes sure that there's nothing in the flash
20
20
  #
21
+ # For historic reasons, the assigns hash uses string-based keys. So assigns[:person] won't work, but assigns["person"] will. To
22
+ # appease our yearning for symbols, though, an alternative accessor has been deviced using a method call instead of index referencing.
23
+ # So assigns(:person) will work just like assigns["person"], but again, assigns[:person] will not work.
24
+ #
21
25
  # On top of the collections, you have the complete url that a given action redirected to available in redirect_to_url.
22
26
  #
23
27
  # For redirects within the same controller, you can even call follow_redirect and the redirect will be follow triggering another
@@ -19,11 +19,14 @@ module ActionController #:nodoc:
19
19
  if logger.nil?
20
20
  render_without_benchmark(template_name, status)
21
21
  else
22
- db_runtime = ActiveRecord::Base.connection.reset_runtime
22
+ db_runtime = ActiveRecord::Base.connection.reset_runtime if Object.const_defined?("ActiveRecord") && ActiveRecord::Base.connected?
23
23
  @rendering_runtime = Benchmark::measure{ render_without_benchmark(template_name, status) }.real
24
- @db_rt_before_render = db_runtime
25
- @db_rt_after_render = ActiveRecord::Base.connection.reset_runtime
26
- @rendering_runtime -= @db_rt_after_render
24
+
25
+ if Object.const_defined?("ActiveRecord") && ActiveRecord::Base.connected?
26
+ @db_rt_before_render = db_runtime
27
+ @db_rt_after_render = ActiveRecord::Base.connection.reset_runtime
28
+ @rendering_runtime -= @db_rt_after_render
29
+ end
27
30
  end
28
31
  end
29
32
 
@@ -258,13 +258,19 @@ module Test
258
258
  # execute the request simulating a specific http method and set/volley the response
259
259
  %w( get post put delete head ).each do |method|
260
260
  class_eval <<-EOV
261
- def #{method}(action, parameters = nil, session = nil)
261
+ def #{method}(action, parameters = nil, session = nil, flash = nil)
262
262
  @request.env['REQUEST_METHOD'] = "#{method.upcase}"
263
- process(action, parameters, session)
263
+ process(action, parameters, session, flash)
264
264
  end
265
265
  EOV
266
266
  end
267
267
 
268
+ def xml_http_request(request_method, action, parameters = nil, session = nil, flash = nil)
269
+ @request.env['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'
270
+ self.send(request_method, action, parameters, session, flash)
271
+ end
272
+ alias xhr :xml_http_request
273
+
268
274
  def follow_redirect
269
275
  if @response.redirected_to[:controller]
270
276
  raise "Can't follow redirects outside of current controller (#{@response.redirected_to[:controller]})"
@@ -157,7 +157,7 @@ module ActionView #:nodoc:
157
157
  end
158
158
 
159
159
  def initialize(base_path = nil, assigns_for_first_render = {}, controller = nil)#:nodoc:
160
- @base_path, @assigns = base_path, assigns_for_first_render.with_indifferent_access
160
+ @base_path, @assigns = base_path, assigns_for_first_render
161
161
  @controller = controller
162
162
  end
163
163
 
@@ -10,21 +10,47 @@ module ActionView
10
10
  # and <tt>time_zone_select</tt> methods take an <tt>options</tt> parameter,
11
11
  # a hash.
12
12
  #
13
- # * <tt>:include_blank</tt> - set to true if the first option element of the select element is a blank. Useful if there is not a default value required for the select element.
13
+ # * <tt>:include_blank</tt> - set to true if the first option element of the select element is a blank. Useful if there is not a default value required for the select element. For example,
14
+ #
14
15
  # select("post", "category", Post::CATEGORIES, {:include_blank => true})
15
16
  #
16
- # Could become:
17
+ # could become:
17
18
  #
18
19
  # <select name="post[category]">
19
20
  # <option></option>
20
21
  # <option>joke</option>
21
22
  # <option>poem</option>
22
23
  # </select>
24
+ #
25
+ # Another common case is a select tag for an <tt>belongs_to</tt>-associated object. For example,
26
+ #
27
+ # select("post", "person_id", Person.find_all.collect {|p| [ p.name, p.id ] })
28
+ #
29
+ # could become:
30
+ #
31
+ # <select name="post[person_id]">
32
+ # <option value="1">David</option>
33
+ # <option value="2">Sam</option>
34
+ # <option value="3">Tobias</option>
35
+ # </select>
23
36
  module FormOptionsHelper
24
37
  include ERB::Util
25
38
 
26
39
  # Create a select tag and a series of contained option tags for the provided object and method.
27
40
  # The option currently held by the object will be selected, provided that the object is available.
41
+ # See options_for_select for the required format of the choices parameter.
42
+ #
43
+ # Example with @post.person_id => 1:
44
+ # select("post", "person_id", Person.find_all.collect {|p| [ p.name, p.id ] }, { :include_blank => true })
45
+ #
46
+ # could become:
47
+ #
48
+ # <select name="post[person_id">
49
+ # <option></option>
50
+ # <option value="1" selected="selected">David</option>
51
+ # <option value="2">Sam</option>
52
+ # <option value="3">Tobias</option>
53
+ # </select>
28
54
  #
29
55
  # This can be used to provide a default set of options in the standard way: before rendering the create form, a
30
56
  # new model instance is assigned the default options and bound to @model_name. Usually this model is not saved
@@ -1,4 +1,4 @@
1
- /* Prototype: an object-oriented Javascript library, version 1.2.0
1
+ /* Prototype: an object-oriented Javascript library, version 1.2.1
2
2
  * (c) 2005 Sam Stephenson <sam@conio.net>
3
3
  *
4
4
  * THIS FILE IS AUTOMATICALLY GENERATED. When sending patches, please diff
@@ -11,7 +11,7 @@
11
11
  /*--------------------------------------------------------------------------*/
12
12
 
13
13
  var Prototype = {
14
- Version: '1.2.0'
14
+ Version: '1.2.1'
15
15
  }
16
16
 
17
17
  var Class = {
@@ -184,7 +184,8 @@ Ajax.Request.prototype = (new Ajax.Base()).extend({
184
184
  if (this.options.method == 'get')
185
185
  url += '?' + this.options.parameters + '&_=';
186
186
 
187
- this.transport.open(this.options.method, url, true);
187
+ this.transport.open(this.options.method, url,
188
+ this.options.asynchronous);
188
189
 
189
190
  if (this.options.asynchronous) {
190
191
  this.transport.onreadystatechange = this.onStateChange.bind(this);
data/rakefile CHANGED
@@ -8,7 +8,7 @@ require 'rake/contrib/rubyforgepublisher'
8
8
 
9
9
  PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
10
10
  PKG_NAME = 'actionpack'
11
- PKG_VERSION = '1.8.0' + PKG_BUILD
11
+ PKG_VERSION = '1.8.1' + PKG_BUILD
12
12
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
13
13
 
14
14
  RELEASE_NAME = "REL #{PKG_VERSION}"
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.8
3
3
  specification_version: 1
4
4
  name: actionpack
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.8.0
7
- date: 2005-04-19
6
+ version: 1.8.1
7
+ date: 2005-04-20
8
8
  summary: Web-flow and rendering framework putting the VC in MVC.
9
9
  require_paths:
10
10
  - lib