Hi, when I create an action link in the same controller I do the
following to show the result in the flash[:info]:
controllers/clients_controller.rb:
--------------------------------------------
config.action_links.add :block,
:label => "Block.", :type => :member,
:inline => true, :position => false,
:crud_type => :update
[...]
def block
@record = .....
[...]
flash[:info] = message
end
--------------------------------------------
views/clients/block.js.jrs:
--------------------------------------------
page.call "ActiveScaffold.update_row", element_row_id(:action =>
"list", :id => @record.id),
render(:partial => "list_record", :locals => {:record => @record})
page.replace_html active_scaffold_messages_id, :partial => "messages"
--------------------------------------------
This works great. However now I need to call to an external controller
(not an AS controller) from a member action link in a AS list view, so
the action is invoked and it must render exactly the same as above.
So now I have.
controllers/clients_controller.rb:
--------------------------------------------
config.action_links.add :block,
:controller => :api, # <---- NOTE
:label => "Block.", :type => :member,
:inline => true, :position => false,
:crud_type => :update
--------------------------------------------
controllers/api_controller.rb:
--------------------------------------------
def block
@record = .....
[...]
flash[:info] = message
end
--------------------------------------------
views/api/block.js.jrs:
--------------------------------------------
page.call "ActiveScaffold.update_row", element_row_id(:action =>
"list", :id => @record.id),
render(:partial => "list_record", :locals => {:record => @record})
page.replace_html active_scaffold_messages_id, :partial => "messages"
--------------------------------------------
Unfortunately it doesn't work as I get an error:
Processing ApiController#block (for X:X:X:X at 2010-07-08 19:40:45) [GET]
Parameters: {"action"=>"block", "_method"=>"get", "id"=>"124",
"controller"=>"api"}
Rendering api/block
ActionView::TemplateError (Missing template _list_record.erb in view
path ) on line #2 of app/views/api/block.js.rjs:
1: # Para actualizar el contenido de la fila y además mostrar el flash.
2: page.call "ActiveScaffold.update_row", element_row_id(:action =>
"list", :id => @record.id), render(:partial => "list_record",
:controller => :clients, :locals => {:record => @record})
3: page.replace_html active_scaffold_messages_id, :partial =>
"messages", :controller => :clients
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/paths.rb:66:in
`find_template_without_active_scaffold'
vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb:11:in
`find_template'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/partials.rb:236:in
`_unmemoized__pick_partial_template'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/memoizable.rb:84:in
`_pick_partial_template'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/partials.rb:184:in
`render_partial'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/base.rb:267:in
`render_without_active_scaffold'
Any help please? Really thanks a lot.
--
Iñaki Baz Castillo
<[email protected]>
--
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/activescaffold?hl=en.