actionpack 1.4.0 → 1.5.0

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.

Files changed (84) hide show
  1. data/CHANGELOG +66 -0
  2. data/README +94 -64
  3. data/install.rb +1 -20
  4. data/lib/action_controller.rb +15 -7
  5. data/lib/action_controller/assertions/action_pack_assertions.rb +56 -3
  6. data/lib/action_controller/base.rb +137 -64
  7. data/lib/action_controller/caching.rb +11 -11
  8. data/lib/action_controller/cgi_ext/cgi_ext.rb +2 -2
  9. data/lib/action_controller/cgi_ext/raw_post_data_fix.rb +4 -4
  10. data/lib/action_controller/cgi_process.rb +9 -1
  11. data/lib/action_controller/components.rb +73 -0
  12. data/lib/action_controller/cookies.rb +1 -1
  13. data/lib/action_controller/dependencies.rb +6 -1
  14. data/lib/action_controller/filters.rb +1 -1
  15. data/lib/action_controller/flash.rb +3 -3
  16. data/lib/action_controller/helpers.rb +17 -21
  17. data/lib/action_controller/layout.rb +2 -2
  18. data/lib/action_controller/request.rb +16 -6
  19. data/lib/action_controller/rescue.rb +15 -3
  20. data/lib/action_controller/routing.rb +304 -0
  21. data/lib/action_controller/scaffolding.rb +10 -12
  22. data/lib/action_controller/session/active_record_store.rb +4 -7
  23. data/lib/action_controller/session/mem_cache_store.rb +2 -2
  24. data/lib/action_controller/templates/rescues/_request_and_response.rhtml +9 -1
  25. data/lib/action_controller/templates/rescues/diagnostics.rhtml +1 -1
  26. data/lib/action_controller/templates/rescues/routing_error.rhtml +8 -0
  27. data/lib/action_controller/test_process.rb +29 -7
  28. data/lib/action_controller/url_rewriter.rb +28 -112
  29. data/lib/action_view.rb +1 -1
  30. data/lib/action_view/base.rb +44 -17
  31. data/lib/action_view/helpers/active_record_helper.rb +1 -1
  32. data/lib/action_view/helpers/asset_tag_helper.rb +59 -0
  33. data/lib/action_view/helpers/date_helper.rb +24 -13
  34. data/lib/action_view/helpers/form_helper.rb +6 -1
  35. data/lib/action_view/helpers/form_options_helper.rb +87 -9
  36. data/lib/action_view/helpers/form_tag_helper.rb +80 -0
  37. data/lib/action_view/helpers/tag_helper.rb +0 -23
  38. data/lib/action_view/helpers/text_helper.rb +26 -1
  39. data/lib/action_view/helpers/url_helper.rb +29 -35
  40. data/lib/action_view/partials.rb +2 -2
  41. data/lib/action_view/vendor/builder/xmlbase.rb +3 -3
  42. data/rakefile +5 -2
  43. data/test/abstract_unit.rb +3 -1
  44. data/test/controller/action_pack_assertions_test.rb +29 -1
  45. data/test/controller/active_record_assertions_test.rb +109 -101
  46. data/test/controller/base_tests.rb +72 -0
  47. data/test/controller/components_test.rb +74 -0
  48. data/test/controller/cookie_test.rb +0 -9
  49. data/test/controller/custom_handler_test.rb +33 -0
  50. data/test/controller/filters_test.rb +36 -0
  51. data/test/controller/helper_test.rb +27 -10
  52. data/test/controller/redirect_test.rb +23 -31
  53. data/test/controller/render_test.rb +81 -66
  54. data/test/controller/request_test.rb +22 -0
  55. data/test/controller/routing_tests.rb +490 -0
  56. data/test/controller/{url_test.rb → url_obsolete.rb} +24 -14
  57. data/test/controller/url_obsolete.rb.rej +747 -0
  58. data/test/fixtures/fun/games/hello_world.rhtml +1 -0
  59. data/test/fixtures/helpers/fun/games_helper.rb +3 -0
  60. data/test/template/asset_tag_helper_test.rb +45 -0
  61. data/test/template/form_options_helper_test.rb +161 -1
  62. data/test/template/form_tag_helper_test.rb +22 -0
  63. data/test/template/text_helper_test.rb +7 -0
  64. data/test/template/url_helper_test.rb +5 -2
  65. data/test/template/url_helper_test.rb.rej +105 -0
  66. metadata +32 -27
  67. data/lib/action_controller/support/binding_of_caller.rb +0 -83
  68. data/lib/action_controller/support/breakpoint.rb +0 -518
  69. data/lib/action_controller/support/class_attribute_accessors.rb +0 -57
  70. data/lib/action_controller/support/class_inheritable_attributes.rb +0 -117
  71. data/lib/action_controller/support/clean_logger.rb +0 -10
  72. data/lib/action_controller/support/core_ext.rb +0 -1
  73. data/lib/action_controller/support/core_ext/hash.rb +0 -5
  74. data/lib/action_controller/support/core_ext/hash/keys.rb +0 -35
  75. data/lib/action_controller/support/core_ext/numeric.rb +0 -7
  76. data/lib/action_controller/support/core_ext/numeric/bytes.rb +0 -33
  77. data/lib/action_controller/support/core_ext/numeric/time.rb +0 -59
  78. data/lib/action_controller/support/core_ext/object_and_class.rb +0 -24
  79. data/lib/action_controller/support/core_ext/string.rb +0 -5
  80. data/lib/action_controller/support/core_ext/string/inflections.rb +0 -45
  81. data/lib/action_controller/support/dependencies.rb +0 -63
  82. data/lib/action_controller/support/inflector.rb +0 -84
  83. data/lib/action_controller/support/misc.rb +0 -8
  84. data/lib/action_controller/support/module_attribute_accessors.rb +0 -57
@@ -1,84 +0,0 @@
1
- # The Inflector transforms words from singular to plural, class names to table names, modulized class names to ones without,
2
- # and class names to foreign keys.
3
- module Inflector
4
- extend self
5
-
6
- def pluralize(word)
7
- result = word.to_s.dup
8
- plural_rules.each do |(rule, replacement)|
9
- break if result.gsub!(rule, replacement)
10
- end
11
- return result
12
- end
13
-
14
- def singularize(word)
15
- result = word.to_s.dup
16
- singular_rules.each do |(rule, replacement)|
17
- break if result.gsub!(rule, replacement)
18
- end
19
- return result
20
- end
21
-
22
- def camelize(lower_case_and_underscored_word)
23
- lower_case_and_underscored_word.to_s.gsub(/(^|_)(.)/){$2.upcase}
24
- end
25
-
26
- def underscore(camel_cased_word)
27
- camel_cased_word.to_s.gsub(/([A-Z]+)([A-Z])/,'\1_\2').gsub(/([a-z])([A-Z])/,'\1_\2').downcase
28
- end
29
-
30
- def humanize(lower_case_and_underscored_word)
31
- lower_case_and_underscored_word.to_s.gsub(/_/, " ").capitalize
32
- end
33
-
34
- def demodulize(class_name_in_module)
35
- class_name_in_module.to_s.gsub(/^.*::/, '')
36
- end
37
-
38
- def tableize(class_name)
39
- pluralize(underscore(class_name))
40
- end
41
-
42
- def classify(table_name)
43
- camelize(singularize(table_name))
44
- end
45
-
46
- def foreign_key(class_name, separate_class_name_and_id_with_underscore = true)
47
- Inflector.underscore(Inflector.demodulize(class_name)) +
48
- (separate_class_name_and_id_with_underscore ? "_id" : "id")
49
- end
50
-
51
- private
52
- def plural_rules #:doc:
53
- [
54
- [/(x|ch|ss|sh)$/, '\1es'], # search, switch, fix, box, process, address
55
- [/([^aeiouy]|qu)ies$/, '\1y'],
56
- [/([^aeiouy]|qu)y$/, '\1ies'], # query, ability, agency
57
- [/(?:([^f])fe|([lr])f)$/, '\1\2ves'], # half, safe, wife
58
- [/sis$/, 'ses'], # basis, diagnosis
59
- [/([ti])um$/, '\1a'], # datum, medium
60
- [/person$/, 'people'], # person, salesperson
61
- [/man$/, 'men'], # man, woman, spokesman
62
- [/child$/, 'children'], # child
63
- [/s$/, 's'], # no change (compatibility)
64
- [/$/, 's']
65
- ]
66
- end
67
-
68
- def singular_rules #:doc:
69
- [
70
- [/(x|ch|ss)es$/, '\1'],
71
- [/movies$/, 'movie'],
72
- [/([^aeiouy]|qu)ies$/, '\1y'],
73
- [/([lr])ves$/, '\1f'],
74
- [/([^f])ves$/, '\1fe'],
75
- [/(analy|ba|diagno|parenthe|progno|synop|the)ses$/, '\1sis'],
76
- [/([ti])a$/, '\1um'],
77
- [/people$/, 'person'],
78
- [/men$/, 'man'],
79
- [/status$/, 'status'],
80
- [/children$/, 'child'],
81
- [/s$/, '']
82
- ]
83
- end
84
- end
@@ -1,8 +0,0 @@
1
- def silence_warnings
2
- old_verbose, $VERBOSE = $VERBOSE, nil
3
- begin
4
- yield
5
- ensure
6
- $VERBOSE = old_verbose
7
- end
8
- end
@@ -1,57 +0,0 @@
1
- # Extends the module object with module and instance accessors for class attributes,
2
- # just like the native attr* accessors for instance attributes.
3
- class Module # :nodoc:
4
- def mattr_reader(*syms)
5
- syms.each do |sym|
6
- class_eval <<-EOS
7
- if ! defined? @@#{sym.id2name}
8
- @@#{sym.id2name} = nil
9
- end
10
-
11
- def self.#{sym.id2name}
12
- @@#{sym}
13
- end
14
-
15
- def #{sym.id2name}
16
- @@#{sym}
17
- end
18
-
19
- def call_#{sym.id2name}
20
- case @@#{sym.id2name}
21
- when Symbol then send(@@#{sym})
22
- when Proc then @@#{sym}.call(self)
23
- when String then @@#{sym}
24
- else nil
25
- end
26
- end
27
- EOS
28
- end
29
- end
30
-
31
- def mattr_writer(*syms)
32
- syms.each do |sym|
33
- class_eval <<-EOS
34
- if ! defined? @@#{sym.id2name}
35
- @@#{sym.id2name} = nil
36
- end
37
-
38
- def self.#{sym.id2name}=(obj)
39
- @@#{sym.id2name} = obj
40
- end
41
-
42
- def self.set_#{sym.id2name}(obj)
43
- @@#{sym.id2name} = obj
44
- end
45
-
46
- def #{sym.id2name}=(obj)
47
- @@#{sym} = obj
48
- end
49
- EOS
50
- end
51
- end
52
-
53
- def mattr_accessor(*syms)
54
- mattr_reader(*syms)
55
- mattr_writer(*syms)
56
- end
57
- end