You are here: Forums Ask a Rails expert String iteration using each_li...
Posted in Forums : Ask a Rails expert
|
Authority 0
Posting Rating 0
Sign in to rate this post
|
I have the following code which displays instructions in an ordered list. When it’s rendered in the browser, it outputs all of the instructions at the end in a single line. Am I doing something wrong? See output below for example. Code:
Output: Instructions:
Roast garlic test eat icecream Rails 3 rc2 ruby 1.9.2dev (2010-07-11 revision 28618) |
Authority 12
Posting Rating 0
Sign in to rate this post
|
Hey Man use HTML Tag <% @recipe.instructions.each_line do |instruction| %> < li > <%=instruction %> < /li > <% end %> Use this Code to Get tour Desired Output |
|
Authority 0
Posting Rating 0
Sign in to rate this post
|
Actually it is using html, the code didn’t show up correctly in this post. See line 50 here http://github.com/quattro004/scratches/blob/master/app/views/recipes/show.html.erb Any other ideas? Thanks. |
Authority 12
Posting Rating 0
Sign in to rate this post
|
I saw your Controller File. In Which method u select the @recipe variable |
|
Authority 62
Posting Rating 99
Sign in to rate this post
|
Reese, You have this on line 49: Using the output tag is causing the value of that block to be output, as well as the block itself. |
|
Authority 0
Posting Rating 0
Sign in to rate this post
|
Jason, I know this has to be something simple but I’m new to ruby and rails :( |
Authority 37
Posting Rating 0
Sign in to rate this post
|
If you use the alternate loop style instead, it’ll work: for instruction in @recipe.instructions In this case, it does the same thing as each_line, and this won’t raise any deprecation errors. |
Authority 0
Posting Rating 22
Sign in to rate this post
|
Also to exchange the season when more heat wear, wear less cold, we are not worried about this time in the end is what it is appropriate to wear, what to wear only type it? Do not worry, take a look at the stars beat the street know, just add pieces of uniforms, warm and be stylish. |
Ask a Rails expert : nested application ApplicationController get called intead of children::ApplicationController
Ask a Rails expert : Best way to structure a database for a large/static dataset
Ask a Rails expert : Ruby Developer (ROR) - Scottish based (Remote working from within the UK)
Ask a Rails expert : Above Ground Pool Supplies
Ask a Rails expert : How to get url params in observer or model in Rails 3.1
Ask a Rails expert : What can persuade you to hire Junior Ruby devs with significant PHP experience?
Ask a Rails expert : What industry value does the Ruby or Rails Certification currently have?
Ask a Rails expert : Louis Vuitton Damier Azur Canvas specially sale ( www.salecheaplouisvuitton.com )
Ask a Rails expert : ·How to check errors/puts statements from ruby files which are under cronob
Ask a Rails expert : Louis Vuitton cheap Soft Sided Luggagespecial offer( www.salecheaplouisvuitton.com )