ruby - Rails send method to namespaced module -
i trying call method inside namespaced module. trying do, "undefined method" error. calling module method without send method working correctly.
variable = send "namespace::#{type.capitalize}helper.#{type}_method".to_sym, params
thanks help.
(rails 4.1, ruby 2.1.1)
variable = "namespace::#{type.capitalize}helper".constantize. send( "#{type}_method".to_sym, params )
(broken 2 lines, should still work because of trailing .
.) send
takes method name, not whole classname.method
code. you're doing:
namespace::somehelper.send( "sometype_method".to_sym, params)
Comments
Post a Comment