programmable-rc_actions 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,11 @@
1
1
  module Programmable
2
2
  module ResourceController
3
3
  module Actions
4
- include Programmable::ResourceController::CommonActions
4
+ extend Programmable::ResourceController::AddCommonActions
5
+
6
+ add_common_actions
7
+
8
+ include Programmable::ResourceController::ServiceMethods
5
9
 
6
10
  declarations do
7
11
  before_filter :assign_new_resource, :only => [:new, :create]
@@ -14,7 +18,11 @@ module Programmable
14
18
  end
15
19
 
16
20
  module SingletonActions
17
- include Programmable::ResourceController::CommonActions
21
+ extend Programmable::ResourceController::AddCommonActions
22
+
23
+ add_common_actions
24
+
25
+ include Programmable::ResourceController::ServiceMethods
18
26
 
19
27
  declarations do
20
28
  before_filter :assign_new_resource, :only => [:new, :create]
@@ -1,29 +1,35 @@
1
1
  module Programmable
2
2
  module ResourceController
3
- module CommonActions
4
- def show
5
- end
3
+ module AddCommonActions
4
+ private
6
5
 
7
- def new
8
- end
6
+ def add_common_actions
7
+ define_method :show do
8
+ end
9
9
 
10
- def create
11
- @resource_saved = resource.save
12
- response_for_create
13
- end
10
+ define_method :new do
11
+ end
14
12
 
15
- def edit
16
- end
13
+ define_method :create do
14
+ @resource_saved = resource.save
15
+ response_for_create
16
+ end
17
17
 
18
- def update
19
- @resource_saved = resource.update_attributes params[resource_name]
20
- response_for_update
21
- end
18
+ define_method :edit do
19
+ end
20
+
21
+ define_method :update do
22
+ @resource_saved = resource.update_attributes params[resource_name]
23
+ response_for_update
24
+ end
22
25
 
23
- def destroy
24
- response_for_destroy resource.destroy
26
+ define_method :destroy do
27
+ response_for_destroy resource.destroy
28
+ end
25
29
  end
30
+ end
26
31
 
32
+ module ServiceMethods
27
33
  private
28
34
 
29
35
  def response_for_create
@@ -55,7 +61,7 @@ module Programmable
55
61
 
56
62
  def after_create_url
57
63
  resource_path
58
- end
64
+ end
59
65
 
60
66
  def after_update_url
61
67
  resource_path
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: programmable-rc_actions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilia Ablamonov
@@ -39,6 +39,7 @@ files:
39
39
  - lib/rc_actions.rb
40
40
  has_rdoc: true
41
41
  homepage: http://github.com/programmable/rc_actions
42
+ licenses:
42
43
  post_install_message:
43
44
  rdoc_options:
44
45
  - --quiet
@@ -62,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
63
  requirements: []
63
64
 
64
65
  rubyforge_project:
65
- rubygems_version: 1.2.0
66
+ rubygems_version: 1.3.5
66
67
  signing_key:
67
68
  specification_version: 2
68
69
  summary: Better actions for resources_controller plugin.