js-routes 0.7.4 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
data/Readme.md CHANGED
@@ -81,6 +81,13 @@ js-routes itself do not have security holes. It makes URLs
81
81
  without access protection more reachable by potential attacker.
82
82
  In order to prevent this use `:exclude` option for sensitive urls like `/admin_/`
83
83
 
84
+ ### Spork
85
+
86
+ When using Spork and `Spork.trap_method(Rails::Application::RoutesReloader, :reload!)` you should also do:
87
+
88
+ ``` ruby
89
+ Spork.trap_method(JsRoutes, :generate!)
90
+ ```
84
91
 
85
92
  ### Advantages over alternatives
86
93
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.4
1
+ 0.7.5
data/js-routes.gemspec CHANGED
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{js-routes}
8
- s.version = "0.7.4"
7
+ s.name = "js-routes"
8
+ s.version = "0.7.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bogdan Gusiev"]
12
- s.date = %q{2012-01-22}
13
- s.description = %q{Generates javascript file that defines all Rails named routes as javascript helpers}
14
- s.email = %q{agresso@gmail.com}
12
+ s.date = "2012-02-13"
13
+ s.description = "Generates javascript file that defines all Rails named routes as javascript helpers"
14
+ s.email = "agresso@gmail.com"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt"
17
17
  ]
@@ -36,14 +36,13 @@ Gem::Specification.new do |s|
36
36
  "spec/post_rails_init_spec.rb",
37
37
  "spec/spec_helper.rb"
38
38
  ]
39
- s.homepage = %q{http://github.com/railsware/js-routes}
39
+ s.homepage = "http://github.com/railsware/js-routes"
40
40
  s.licenses = ["MIT"]
41
41
  s.require_paths = ["lib"]
42
- s.rubygems_version = %q{1.3.7}
43
- s.summary = %q{Brings Rails named routes to javascript}
42
+ s.rubygems_version = "1.8.10"
43
+ s.summary = "Brings Rails named routes to javascript"
44
44
 
45
45
  if s.respond_to? :specification_version then
46
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
47
46
  s.specification_version = 3
48
47
 
49
48
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
data/lib/routes.js CHANGED
@@ -68,7 +68,7 @@
68
68
  return "";
69
69
  }
70
70
  if (typeof(object) == "object") {
71
- return (object.to_param || object.id || object).toString();
71
+ return ((typeof(object.to_param) == "function" && object.to_param()) || object.to_param || object.id || object).toString();
72
72
  } else {
73
73
  return object.toString();
74
74
  }
@@ -181,6 +181,10 @@ describe JsRoutes do
181
181
  evaljs("Routes.inbox_path({id: 1, to_param: 'my'})").should == routes.inbox_path(inbox)
182
182
  end
183
183
 
184
+ it "should call to_param if it is a function" do
185
+ evaljs("Routes.inbox_path({id: 1, to_param: function(){ return 'my';}})").should == routes.inbox_path(inbox)
186
+ end
187
+
184
188
  it "should support options argument" do
185
189
  evaljs(
186
190
  "Routes.inbox_message_path({id:1, to_param: 'my'}, {id:2}, {custom: true, format: 'json'})"
metadata CHANGED
@@ -1,123 +1,90 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: js-routes
3
- version: !ruby/object:Gem::Version
4
- hash: 11
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 7
9
- - 4
10
- version: 0.7.4
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.5
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Bogdan Gusiev
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-01-22 00:00:00 +02:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
12
+ date: 2012-02-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: &20189100 !ruby/object:Gem::Requirement
23
17
  none: false
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- hash: 7
28
- segments:
29
- - 3
30
- - 0
31
- version: "3.0"
32
- requirement: *id001
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '3.0'
33
22
  type: :runtime
34
- name: rails
35
23
  prerelease: false
36
- - !ruby/object:Gem::Dependency
37
- version_requirements: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *20189100
25
+ - !ruby/object:Gem::Dependency
26
+ name: therubyracer
27
+ requirement: &20199080 !ruby/object:Gem::Requirement
38
28
  none: false
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- hash: 3
43
- segments:
44
- - 0
45
- version: "0"
46
- requirement: *id002
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
47
33
  type: :development
48
- name: therubyracer
49
34
  prerelease: false
50
- - !ruby/object:Gem::Dependency
51
- version_requirements: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *20199080
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ requirement: &20194300 !ruby/object:Gem::Requirement
52
39
  none: false
53
- requirements:
40
+ requirements:
54
41
  - - ~>
55
- - !ruby/object:Gem::Version
56
- hash: 19
57
- segments:
58
- - 2
59
- - 7
60
- - 0
42
+ - !ruby/object:Gem::Version
61
43
  version: 2.7.0
62
- requirement: *id003
63
44
  type: :development
64
- name: rspec
65
45
  prerelease: false
66
- - !ruby/object:Gem::Dependency
67
- version_requirements: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *20194300
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: &20205180 !ruby/object:Gem::Requirement
68
50
  none: false
69
- requirements:
51
+ requirements:
70
52
  - - ~>
71
- - !ruby/object:Gem::Version
72
- hash: 23
73
- segments:
74
- - 1
75
- - 0
76
- - 0
53
+ - !ruby/object:Gem::Version
77
54
  version: 1.0.0
78
- requirement: *id004
79
55
  type: :development
80
- name: bundler
81
56
  prerelease: false
82
- - !ruby/object:Gem::Dependency
83
- version_requirements: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *20205180
58
+ - !ruby/object:Gem::Dependency
59
+ name: jeweler
60
+ requirement: &20213600 !ruby/object:Gem::Requirement
84
61
  none: false
85
- requirements:
62
+ requirements:
86
63
  - - ~>
87
- - !ruby/object:Gem::Version
88
- hash: 11
89
- segments:
90
- - 1
91
- - 6
92
- - 2
64
+ - !ruby/object:Gem::Version
93
65
  version: 1.6.2
94
- requirement: *id005
95
66
  type: :development
96
- name: jeweler
97
67
  prerelease: false
98
- - !ruby/object:Gem::Dependency
99
- version_requirements: &id006 !ruby/object:Gem::Requirement
68
+ version_requirements: *20213600
69
+ - !ruby/object:Gem::Dependency
70
+ name: rcov
71
+ requirement: &20219180 !ruby/object:Gem::Requirement
100
72
  none: false
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- hash: 3
105
- segments:
106
- - 0
107
- version: "0"
108
- requirement: *id006
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
109
77
  type: :development
110
- name: rcov
111
78
  prerelease: false
112
- description: Generates javascript file that defines all Rails named routes as javascript helpers
79
+ version_requirements: *20219180
80
+ description: Generates javascript file that defines all Rails named routes as javascript
81
+ helpers
113
82
  email: agresso@gmail.com
114
83
  executables: []
115
-
116
84
  extensions: []
117
-
118
- extra_rdoc_files:
85
+ extra_rdoc_files:
119
86
  - LICENSE.txt
120
- files:
87
+ files:
121
88
  - .document
122
89
  - .rspec
123
90
  - .travis.yml
@@ -137,39 +104,32 @@ files:
137
104
  - spec/js_routes_spec.rb
138
105
  - spec/post_rails_init_spec.rb
139
106
  - spec/spec_helper.rb
140
- has_rdoc: true
141
107
  homepage: http://github.com/railsware/js-routes
142
- licenses:
108
+ licenses:
143
109
  - MIT
144
110
  post_install_message:
145
111
  rdoc_options: []
146
-
147
- require_paths:
112
+ require_paths:
148
113
  - lib
149
- required_ruby_version: !ruby/object:Gem::Requirement
114
+ required_ruby_version: !ruby/object:Gem::Requirement
150
115
  none: false
151
- requirements:
152
- - - ">="
153
- - !ruby/object:Gem::Version
154
- hash: 3
155
- segments:
116
+ requirements:
117
+ - - ! '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ segments:
156
121
  - 0
157
- version: "0"
158
- required_rubygems_version: !ruby/object:Gem::Requirement
122
+ hash: 2245053018798616872
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
159
124
  none: false
160
- requirements:
161
- - - ">="
162
- - !ruby/object:Gem::Version
163
- hash: 3
164
- segments:
165
- - 0
166
- version: "0"
125
+ requirements:
126
+ - - ! '>='
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
167
129
  requirements: []
168
-
169
130
  rubyforge_project:
170
- rubygems_version: 1.3.7
131
+ rubygems_version: 1.8.10
171
132
  signing_key:
172
133
  specification_version: 3
173
134
  summary: Brings Rails named routes to javascript
174
135
  test_files: []
175
-