Added: 5 months ago
From: andrewperk
Views: 1,693
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (9)

Sign In or Sign Up now to post a comment!
  • Once again, verry helpfull tutorial.

  • 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.

  • @andrewperk I even know why I put the equals sign there.

    Thanks for the reply, patience, and videos.

  • @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 :)

  • How is params[:post] working, you dint pass any parameter from html having :post as its name??

  • @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 Thankx a lot, btw Great tutorial :)

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more