activeresource 4.0.0.beta1 → 4.0.0

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

Potentially problematic release.


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

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 931c2a3ac5d3c4b76c2165a6d58c44f4aedab23e
4
- data.tar.gz: 1a3056f9e297d082f97bdb7350023c571c3dc79d
3
+ metadata.gz: 82b2154f86c57749c08bad97d435fcb1cdde0408
4
+ data.tar.gz: 1c514b63dc4ea568665f161079adff26d9cdb611
5
5
  SHA512:
6
- metadata.gz: 459d6c6a88802add4531118ac6f9191c27196e805be61f35e60787a8fc4a4b380cf456c459a63f6f4c6d9c83f8397dec1fdb9d70f8265c2a8358c978dc919d70
7
- data.tar.gz: 05bea224b9115b0ab07cdf8c18846b7327ccabf4265d889ee6caff0437a4349de9f68b9e249c5a8679551001da05322a08b28d5cfcf9dee90c12ae4a6a3fa4d4
6
+ metadata.gz: 477756e26f0d705234fd0c1d7511d0850e569691ccb8bdbb8974fec70445e10d6d607cc852b2652e1a6335baf1b3400f23380b392c1fc203346f2344eb503326
7
+ data.tar.gz: ccad2db0464de0b474d4d3dc1a36d1b86aa19d2ad20c6b68b5fe6170b4663567c07d445b8a1c0811e384fca02637f1f0631af0cf1e5b2842f86ebbad88d1c6f6
@@ -173,6 +173,34 @@ Destruction of a resource can be invoked as a class and instance method of the r
173
173
  Person.delete(2) # => true
174
174
  Person.exists?(2) # => false
175
175
 
176
+ ==== Associations
177
+
178
+ Relationships between resources can be declared using the standard association syntax
179
+ that should be familiar to anyone who uses activerecord. For example, using the
180
+ class definition below:
181
+
182
+ class Post < ActiveResource::Base
183
+ self.site = "http://blog.io"
184
+ has_many :comments
185
+ end
186
+
187
+ post = Post.find(1) # issues GET http://blog.io/posts/1.json
188
+ comments = post.comments # issues GET http://blog.io/posts/1/comments.json
189
+
190
+
191
+ If you control the server, you may wish to include nested resources thus avoiding a
192
+ second network request. Given the resource above, if the response includes comments
193
+ in the response, they will be automatically loaded into the activeresource object.
194
+ The server-side model can be adjusted as follows to include comments in the response.
195
+
196
+ class Post < ActiveRecord::Base
197
+ has_many :comments
198
+
199
+ def as_json(options)
200
+ super.merge(:include=>[:comments])
201
+ end
202
+ end
203
+
176
204
  == License
177
205
 
178
206
  Active Resource is released under the MIT license:
@@ -78,7 +78,7 @@ module ActiveResource
78
78
  #
79
79
  # Since simple CRUD/life cycle methods can't accomplish every task, Active Resource also supports
80
80
  # defining your own custom REST methods. To invoke them, Active Resource provides the <tt>get</tt>,
81
- # <tt>post</tt>, <tt>put</tt> and <tt>\delete</tt> methods where you can specify a custom REST method
81
+ # <tt>post</tt>, <tt>put</tt> and <tt>delete</tt> methods where you can specify a custom REST method
82
82
  # name to invoke.
83
83
  #
84
84
  # # POST to the custom 'register' REST method, i.e. POST /people/new/register.json.
@@ -3,7 +3,7 @@ module ActiveResource
3
3
  MAJOR = 4
4
4
  MINOR = 0
5
5
  TINY = 0
6
- PRE = "beta1"
6
+ PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
9
9
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeresource
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.beta1
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-03 00:00:00.000000000 Z
11
+ date: 2013-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.0.beta1
19
+ version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 4.0.0.beta1
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activemodel
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 4.0.0.beta1
33
+ version: '4.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: 4.0.0.beta1
40
+ version: '4.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rails-observers
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -130,12 +130,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
130
130
  version: 1.9.3
131
131
  required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  requirements:
133
- - - '>'
133
+ - - '>='
134
134
  - !ruby/object:Gem::Version
135
- version: 1.3.1
135
+ version: '0'
136
136
  requirements: []
137
137
  rubyforge_project:
138
- rubygems_version: 2.0.0
138
+ rubygems_version: 2.0.3
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: REST modeling framework (part of Rails).