You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Split::EncapsulatedHelper can't be used in mailer views #256
and we call test_enabled? from a mailer view. This ends up raising an error:
ActionView::Template::Error:
undefined method `params' for #<MyMailer:0x007ff87555bd18>
The problem is this line in Split::EncapsulatedHelper:
_params=defined?(params) ? params : {}
Due to a Rails bug (rails/rails#15613), defined?(params) returns true even though the method is not defined. The view delegates params, along with other methods, to the controller (and in this case, the "controller" is a mailer, which doesn't define that method).
I think Rails is the right place to fix the bug, but it would probably still be worthwhile to work around the issue in Split. A couple of options for this:
Put a begin/rescue around the call to params.
Don't call params at all; if there's a params method defined, then you're probably in a controller anyway, so you could just use Split::Helper.
Activity
andrew commentedon Jun 10, 2014
@afn If we can avoid calling params at all that would be better I think, would you like to put a pull request together for that?
splitrb#256 avoiding call to params in EncapsulatedHelper
Merge pull request #257 from afn/no-params