serviceable 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/serviceable.rb +11 -2
  2. metadata +4 -4
@@ -25,8 +25,9 @@ module Serviceable
25
25
  def acts_as_service(object,defaults={})
26
26
 
27
27
  before_filter :assign_new_instance, only: :create
28
+ before_filter :did_assign_new_instance, only: :create
28
29
  before_filter :assign_existing_instance, only: [ :show, :update, :destroy ]
29
- before_filter :did_assign_instance, only: [ :show, :update ]
30
+ before_filter :did_assign_existing_instance, only: [ :show, :update ]
30
31
  before_filter :assign_collection, only: [ :index, :count ]
31
32
  before_filter :did_assign_collection, only: [ :index, :count ]
32
33
 
@@ -170,11 +171,15 @@ module Serviceable
170
171
  @instance = @instance.find(params[:id])
171
172
  end
172
173
 
174
+ define_method("did_assign_existing_instance") do
175
+ # do nothing
176
+ end
177
+
173
178
  define_method("assign_new_instance") do
174
179
  @instance = object.to_s.camelize.constantize.new(params[object])
175
180
  end
176
181
 
177
- define_method("did_assign_instance") do
182
+ define_method("did_assign_new_instance") do
178
183
  # do nothing
179
184
  end
180
185
 
@@ -231,6 +236,10 @@ module Serviceable
231
236
  end
232
237
  end
233
238
 
239
+ define_method("did_assign_collection") do
240
+ # do nothing
241
+ end
242
+
234
243
  define_method("array_for") do |obj|
235
244
  if obj.kind_of?(Hash)
236
245
  arr = obj.keys
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serviceable
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 2
10
- version: 0.6.2
9
+ - 3
10
+ version: 0.6.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Aubrey Goodman
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-10-02 00:00:00 Z
18
+ date: 2013-11-17 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: Decorate your controller classes with acts_as_service :model_name, and instantly support JSON/XML CRUD interface. Allow client to specify response contents using query string filter parameters.