Jedrin
(Jedrin)
January 28, 2010, 7:27pm
1
I have a helper module (actually in a plugin) and I have this:
def partial_layer_select
args = {:partial => 'map/select_layer',
:locals => {:layers => @layers , :cur_layer =>
@cur_layer }}
return args
end
so that in my view I do
<%= render partial_layer_select %>
but I'd rather call render in the helper in a caller context which it
seems like maybe there is a way to do that ?
Jedrin
(Jedrin)
January 28, 2010, 7:33pm
2
The reason I need to do this is that I used helper_method to allow the
controller methods to be used in the view, but then a in a controller
a partial render is considered a render and only allowed once I guess.
In my plugin I did this, in effect I would like to extend
ApplicationHelper, but I was not sure the best way to go about it and
had been reading this:
http://railspikes.com/2008/8/22/how-to-fix-your-rails-helpers
module GeoCtlInst
def partial_layer_select
args = {:partial => 'map/select_layer',
:locals => {:layers => @layers , :cur_layer =>
@cur_layer }}
return args
end
end
class ActionController::Base
include GeoCtlInst
helper_method :partial_layer_select
end
radar
(Ryan Bigg)
January 29, 2010, 12:13am
3
Sorry to “bounce” you but this list is for Ruby on Rails core issues. For Ruby on Rails help, go to the rubyonrails-talk mailing list.
Thanks!