Class: RenderSync::Action
- Inherits:
-
Object
- Object
- RenderSync::Action
- Includes:
- Actions
- Defined in:
- lib/render_sync/action.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#record ⇒ Object
Returns the value of attribute record.
-
#scope ⇒ Object
Returns the value of attribute scope.
Instance Method Summary collapse
-
#initialize(record, name, *args) ⇒ Action
constructor
A new instance of Action.
- #perform ⇒ Object
-
#test_path ⇒ Object
Just for testing purposes (see test/sync/model_test.rb).
Methods included from Actions
#sync, #sync_destroy, #sync_new, #sync_update
Constructor Details
#initialize(record, name, *args) ⇒ Action
Returns a new instance of Action.
7 8 9 10 11 12 |
# File 'lib/render_sync/action.rb', line 7 def initialize(record, name, *args) = args. @record = record @name = name @scope = () end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/render_sync/action.rb', line 5 def name @name end |
#record ⇒ Object
Returns the value of attribute record.
5 6 7 |
# File 'lib/render_sync/action.rb', line 5 def record @record end |
#scope ⇒ Object
Returns the value of attribute scope.
5 6 7 |
# File 'lib/render_sync/action.rb', line 5 def scope @scope end |
Instance Method Details
#perform ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/render_sync/action.rb', line 14 def perform case name when :new sync_new record, scope: scope when :update sync_update record, scope: scope when :destroy sync_destroy record, scope: scope end end |
#test_path ⇒ Object
Just for testing purposes (see test/sync/model_test.rb)
26 27 28 |
# File 'lib/render_sync/action.rb', line 26 def test_path Resource.new(record, scope).polymorphic_path.to_s end |