In all pages i get braces before content that replace placeholder yield, and if there is at least a flash i get also the dump into braces... i.e. before post {} Our blog i.e after save post and redirect to posts page Your post was saved {:notice=>"Your post was saved"} Our Blog First post Content of first post Why does it show me dump for flashes? Thanks in advance.
@traendone Check your layout file where we looped through the flash hash. You may have put an equals sign in the ERB tag for the loop statement. You only use the equal sign when outputting, not in the actual loop statement or if/else etc... So you should only have an equal sign where we output the value of the loop. <% flash.each do |key, value| %>
@traendone Well youtube won't let me put in the actual code in this comment for some reason, so I tried to use html entities but that still didn't work. The point was to show you how it does not have an equals sign in the loop statement. Look again at the video where we loop through the flash hash in the layout to see it. Hopefully this helped you.
@koolestdudenw7 When we pass in the @post object to the form_for helper in our view it uses the name of that object to create a hash. In our case the hash is named post. When we create the form fields for the title and content attributes these values are stored under that post hash as post[title] and post[content]. This post hash is available to us in the params hash under its symbol name :post, like so: params[:post]. It contains the data for title and content from the form.
Once again, verry helpfull tutorial.
RoflH4x0rz 6 days ago in playlist Uploaded videos
traendone 2 months ago
@traendone Check your layout file where we looped through the flash hash. You may have put an equals sign in the ERB tag for the loop statement. You only use the equal sign when outputting, not in the actual loop statement or if/else etc... So you should only have an equal sign where we output the value of the loop. <% flash.each do |key, value| %>
andrewperk 2 months ago
@traendone Well youtube won't let me put in the actual code in this comment for some reason, so I tried to use html entities but that still didn't work. The point was to show you how it does not have an equals sign in the loop statement. Look again at the video where we loop through the flash hash in the layout to see it. Hopefully this helped you.
andrewperk 2 months ago
@andrewperk I even know why I put the equals sign there.
Thanks for the reply, patience, and videos.
traendone 2 months ago
@traendone hi got the same problem as you while ago and discover my problem was
from
--redirect_to post_path, :notice => "Your post was save"-- i just added letter "s" on the path that will redirect to the index
-- redirect_to posts_path, :notice => "Your post was save"--
just share and not shoving my late answer :)
daphyvincent 1 month ago
How is params[:post] working, you dint pass any parameter from html having :post as its name??
koolestdudenw7 2 months ago
@koolestdudenw7 When we pass in the @post object to the form_for helper in our view it uses the name of that object to create a hash. In our case the hash is named post. When we create the form fields for the title and content attributes these values are stored under that post hash as post[title] and post[content]. This post hash is available to us in the params hash under its symbol name :post, like so: params[:post]. It contains the data for title and content from the form.
andrewperk 2 months ago
@andrewperk Thankx a lot, btw Great tutorial :)
koolestdudenw7 2 months ago