Module: RightRails::ControllerExtensions
- Defined in:
- lib/right_rails/controller_extensions.rb
Overview
The ActionController extensions
Defined Under Namespace
Classes: RenderWrapper
Instance Method Summary collapse
-
#rjs(options = {}, &block) ⇒ Object
This method returns a wrapped RightRails scripts builder.
Instance Method Details
#rjs(options = {}, &block) ⇒ Object
This method returns a wrapped RightRails scripts builder
USAGE:
def create
@zing = Zing.new(params[:zing])
if @zing.save
flash[:notice] = 'Here you go'
render rjs.insert @zing
else
render rjs.replace_form_for(@zing)
end
end
def alert_that
render rjs.alert 'that'
end
def as_a_block
render rjs do |page|
page[:zings].last.hide('slide')
end
end
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/right_rails/controller_extensions.rb', line 32 def rjs(={}, &block) template = if @template @template.send(:_evaluate_assigns_and_ivars) @template else view_context end wrapper = RenderWrapper.new(template, ) if block_given? wrapper.render_block(&block) else wrapper end end |