LocalJumpError: no block given (yield) rails console -
LocalJumpError: no block given (yield) rails console -
i need seek helper method in rails console, error i'm sorry i'm newbie en rails
juan:~/workspace/sample_app$ rails c loading development environment (rails 4.2.0.beta2) 2.1.1 :001 > helper.provide(:title,"home") => nil 2.1.1 :002 > yield :title localjumperror: no block given (yield)
i want reproduce behavior in rails console of view helper method called provide
example
<% provide(:title, "home") %> <!doctype html> <html> <head> <title><%= yield(:title) %> | ruby on rails tutorial sample app</title> </head> <body> <h1>sample app</h1> <p> home page <a href="http://www.railstutorial.org/">ruby on rails tutorial</a> sample application. </p> </body> </html>
you can utilize yield
when within method has been called block. in rails console, in main environment , without block why error.
you can take @ this answer find out how yield
works in view.
the best way you're trying set debugger within view while rendering , test out provided functionality.
ruby-on-rails ruby-on-rails-3 ruby-on-rails-4
Comments
Post a Comment