faceted 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +32 -0
- data/VERSION +1 -1
- data/faceted.gemspec +2 -2
- data/lib/faceted/has_object.rb +1 -0
- metadata +3 -3
data/README.md
CHANGED
@@ -88,6 +88,38 @@ Collectors are simply models that collect multiple instances of another model. A
|
|
88
88
|
l.musicians.first.name
|
89
89
|
=> "American Music Club"
|
90
90
|
|
91
|
+
Controllers
|
92
|
+
-----------
|
93
|
+
Wiring up your controllers is easy. Start with your base controller:
|
94
|
+
|
95
|
+
class MyApi::BaseController < ActionController::Base
|
96
|
+
|
97
|
+
require 'faceted'
|
98
|
+
include Faceted::Controller
|
99
|
+
before_filter :authenticate_user!
|
100
|
+
respond_to :json
|
101
|
+
rescue_from Exception, :with => :render_500
|
102
|
+
rescue_from ActiveRecord::RecordNotFound, :with => :render_404
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
Then create the controllers for your API-specific models:
|
107
|
+
|
108
|
+
class MyApi::MusiciansController < MyApi::BaseController
|
109
|
+
|
110
|
+
def show
|
111
|
+
@musician = MyApi::Musician.new(params)
|
112
|
+
render_response @musician
|
113
|
+
end
|
114
|
+
|
115
|
+
def update
|
116
|
+
@musician = MyApi::Musician.new(params)
|
117
|
+
@musician.save
|
118
|
+
render_response @musician
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
122
|
+
|
91
123
|
Contributing to faceted
|
92
124
|
=======================
|
93
125
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.2
|
data/faceted.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "faceted"
|
8
|
-
s.version = "0.7.
|
8
|
+
s.version = "0.7.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Corey Ehmke", "Max Thom Stahl"]
|
12
|
-
s.date = "2012-09-
|
12
|
+
s.date = "2012-09-26"
|
13
13
|
s.description = "Faceted provides set of tools, patterns, and modules for use in API implementations."
|
14
14
|
s.email = "corey@trunkclub.com"
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/faceted/has_object.rb
CHANGED
@@ -33,6 +33,7 @@ module Faceted
|
|
33
33
|
return false unless schema_fields
|
34
34
|
schema_fields.each{ |k| object.send("#{k}=", self.send(k)) if object.respond_to?("#{k}=") }
|
35
35
|
self.success = object.save
|
36
|
+
self.id = object.id
|
36
37
|
self.errors = object.errors && object.errors.full_messages
|
37
38
|
self.success
|
38
39
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faceted
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-09-
|
13
|
+
date: 2012-09-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -181,7 +181,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
181
181
|
version: '0'
|
182
182
|
segments:
|
183
183
|
- 0
|
184
|
-
hash:
|
184
|
+
hash: 4290966726671123139
|
185
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
186
|
none: false
|
187
187
|
requirements:
|