acts_as_controller_for 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
@@ -110,6 +110,7 @@ module ActsAsControllerFor
|
|
110
110
|
# POST /models
|
111
111
|
# POST /models.xml
|
112
112
|
# POST /models.json
|
113
|
+
# POST /models.js
|
113
114
|
def create(&block)
|
114
115
|
model = self.class.send :class_variable_get, :@@model
|
115
116
|
options = self.class.send :class_variable_get, :@@options
|
@@ -129,10 +130,12 @@ module ActsAsControllerFor
|
|
129
130
|
format.html { redirect_to(send("admin_#{model.name.underscore.pluralize}_path"), :notice => "#{model.name} was successfully created.") }
|
130
131
|
format.xml { render :xml => instance_variable_get(inst_var_ref), :status => :created, :location => [:admin, instance_variable_get(inst_var_ref)] }
|
131
132
|
format.json { render :json => instance_variable_get(inst_var_ref), :status => :created, :location => [:admin, instance_variable_get(inst_var_ref)] }
|
133
|
+
format.js
|
132
134
|
else
|
133
135
|
format.html { render :action => "new" }
|
134
136
|
format.xml { render :xml => instance_variable_get(inst_var_ref).errors, :status => :unprocessable_entity }
|
135
137
|
format.json { render :json => instance_variable_get(inst_var_ref).errors, :status => :unprocessable_entity }
|
138
|
+
format.js { head :unprocessable_entity }
|
136
139
|
end
|
137
140
|
end
|
138
141
|
end
|
@@ -141,6 +144,7 @@ module ActsAsControllerFor
|
|
141
144
|
# PUT /models/:id
|
142
145
|
# PUT /models/:id.xml
|
143
146
|
# PUT /models/:id.json
|
147
|
+
# PUT /models/:id.js
|
144
148
|
def update(&block)
|
145
149
|
model = self.class.send :class_variable_get, :@@model
|
146
150
|
options = self.class.send :class_variable_get, :@@options
|
@@ -155,18 +159,21 @@ module ActsAsControllerFor
|
|
155
159
|
if instance_variable_get(inst_var_ref).update_attributes(block ? yield : params[model.name.underscore])
|
156
160
|
format.html { redirect_to(send("admin_#{model.name.underscore.pluralize}_path"), :notice => "#{model.name} was successfully updated.") }
|
157
161
|
format.xml { head :ok }
|
158
|
-
format.json
|
162
|
+
format.json { head :ok }
|
163
|
+
format.js
|
159
164
|
else
|
160
165
|
format.html { render :action => "edit" }
|
161
166
|
format.xml { render :xml => instance_variable_get(inst_var_ref).errors, :status => :unprocessable_entity }
|
162
167
|
format.json { render :json => instance_variable_get(inst_var_ref).errors, :status => :unprocessable_entity }
|
168
|
+
format.js { head :unprocessable_entity }
|
163
169
|
end
|
164
170
|
end
|
165
171
|
end
|
166
172
|
|
167
|
-
# DELETE /models
|
168
|
-
# DELETE /models
|
169
|
-
# DELETE /models
|
173
|
+
# DELETE /models/:id
|
174
|
+
# DELETE /models/:id.xml
|
175
|
+
# DELETE /models/:id.json
|
176
|
+
# DELETE /models/:id.js
|
170
177
|
def destroy
|
171
178
|
model = self.class.send :class_variable_get, :@@model
|
172
179
|
options = self.class.send :class_variable_get, :@@options
|
@@ -183,6 +190,7 @@ module ActsAsControllerFor
|
|
183
190
|
format.html { redirect_to(send("admin_#{model.name.underscore.pluralize}_path"), :notice => "#{model.name} was destroyed.") }
|
184
191
|
format.xml { head :ok }
|
185
192
|
format.json { head :ok }
|
193
|
+
format.js
|
186
194
|
end
|
187
195
|
end
|
188
196
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: acts_as_controller_for
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jay Hayes
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-08-
|
13
|
+
date: 2011-08-12 00:00:00 Z
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description: This gem is an attempt to identify a pattern of simple rails controllers for common implementations
|