Call income in assistant

The following results in LocalJumpError (no blocks are set to exit)

In the assistant:

def yield_wrapper yield end 

In view:

 <%= yield_wrapper %> 

How would this happen? I want to use it with sublayers along the lines:

 <%= content_for?(:content) ? yield(:content) : yield %> 

And I thought it would be better to name a helper method, for example:

 <%= special_yield(:content) %> 
+4
source share
1 answer

I do not think you can.

yield expects a block, it is called to return the value to the code that implements the block. You mix contexts with its use in layout files to insert content from erb files.

Also, I think this is a bad idea. This does not seem necessary and it looks like he will create more code than he will get rid of.

+1
source

Source: https://habr.com/ru/post/1445918/


All Articles