You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-17Lines changed: 18 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ Source code can be downloaded on GitHub
39
39
Putting Active Resource to use is very similar to Active Record. It's as simple as creating a model class
40
40
that inherits from ActiveResource::Base and providing a <tt>site</tt> class variable to it:
41
41
42
-
```
42
+
```rb
43
43
classPerson < ActiveResource::Base
44
44
self.site ="http://api.people.com:3000"
45
45
end
@@ -48,7 +48,7 @@ end
48
48
Now the Person class is REST enabled and can invoke REST services very similarly to how Active Record invokes
49
49
life cycle methods that operate against a persistent store.
50
50
51
-
```
51
+
```rb
52
52
# Find a person with id = 1
53
53
tyler =Person.find(1)
54
54
Person.exists?(1) # => true
@@ -60,13 +60,14 @@ records. But rather than dealing directly with a database record, you're dealin
60
60
Connection settings (`site`, `headers`, `user`, `password`, `bearer_token`, `proxy`) and the connections themselves are store in
61
61
thread-local variables to make them thread-safe, so you can also set these dynamically, even in a multi-threaded environment, for instance:
62
62
63
-
ActiveResource::Base.site = api_site_for(request)
64
-
63
+
```rb
64
+
ActiveResource::Base.site = api_site_for(request)
65
+
```
65
66
### Authentication
66
67
67
68
Active Resource supports the token based authentication provided by Rails through the <tt>ActionController::HttpAuthentication::Token</tt> class using custom headers.
0 commit comments