Module: RestfulX::ActionController
- Defined in:
- lib/restfulx/rx_action_controller.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#render_with_amf(options = nil, extra_options = {}, &block) ⇒ Object
Defines support for rendering :amf blocks from within Rails constrollers.
-
#render_with_fxml(options = nil, extra_options = {}, &block) ⇒ Object
Defines support for rendering :fxml blocks from within Rails controllers.
Class Method Details
.included(base) ⇒ Object
2 3 4 5 6 7 |
# File 'lib/restfulx/rx_action_controller.rb', line 2 def self.included(base) base.class_eval do alias_method_chain :render, :amf alias_method_chain :render, :fxml end end |
Instance Method Details
#render_with_amf(options = nil, extra_options = {}, &block) ⇒ Object
Defines support for rendering :amf blocks from within Rails constrollers
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/restfulx/rx_action_controller.rb', line 10 def render_with_amf(=nil, ={}, &block) if Hash === and .key?(:amf) object = .delete(:amf) unless String === object object = object.to_amf(, &block) if object.respond_to?(:to_amf) end render_without_amf(:text => object, :content_type => RestfulX::Types::APPLICATION_AMF) else render_without_amf(, , &block) end end |
#render_with_fxml(options = nil, extra_options = {}, &block) ⇒ Object
Defines support for rendering :fxml blocks from within Rails controllers
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/restfulx/rx_action_controller.rb', line 23 def render_with_fxml(=nil, ={}, &block) if Hash === and .key?(:fxml) object = .delete(:fxml) unless String === object object = object.to_fxml(, &block) if object.respond_to?(:to_fxml) end render_without_fxml(:text => object, :content_type => RestfulX::Types::APPLICATION_FXML) else render_without_fxml(, , &block) end end |