SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Dec 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy story_url failed in ch.7 of Rails book

    Hi.
    I have some problem in ch. 7, when i load index.rhtml
    some time it can be load, but sometime can not.
    I don't know why.

    This is error message when it can not load.
    story_url failed to generate from {:action=>"show", ermalink=>nil, :controller=>"story"}, expected: {:action=>"show", :controller=>"story"}, diff: {ermalink=>nil}

    Extracted source (around line #3):

    1: A random link:
    2: <%= link_to @story.name,
    3: story_urlpermalink => @story.permalink) %>
    4:
    5:

    RAILS_ROOT: ./script/../config/..
    Application Trace | Framework Trace | Full Trace

    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/routing.rb:1306:in `raise_named_route_error'
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/routing.rb:1278:in `generate'
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/url_rewriter.rb:107:in `rewrite_path'
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/url_rewriter.rb:70:in `rewrite'
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/base.rb:527:in `url_for'
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_view/helpers/url_helper.rb:27:in `send'
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_view/helpers/url_helper.rb:27:in `url_for'
    (eval):19:in `story_url'
    C:/Rails Application/shovell/app/views/story/index.rhtml:3:in `_run_rhtml_47app47views47story47index46rhtml'

    I use Instant Rails v.1.7 and firefox for browser
    Please tell me why and how i slove this problem if you know.
    Thank you.

  2. #2
    SitePoint Addict ruby-lang's Avatar
    Join Date
    Aug 2007
    Posts
    389
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe some of the permalinks are null in the database? At least the error message is saying @story.permalink is nil.

  3. #3
    SitePoint Enthusiast bdude's Avatar
    Join Date
    Jan 2006
    Location
    In a house.
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, I had that error. It's because when you added permalinks to the database you didn't retroactively apply permalinks to the rest of the items in the db.
    SUPPORT FOR NEW BLOGGERS - TRY THE Blogging Forum

  4. #4
    SitePoint Member
    Join Date
    Dec 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you. I will check it.

  5. #5
    SitePoint Member
    Join Date
    Jan 2008
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    YES, I too had the same problem as explained in the book
    the user will need to update the permalink entries
    although slightly misleading he says will "follow up in chapter 9"
    If you only have 1 entry (the one from the book.) you wouldnt have any null entries.
    hope this helps.
    -=Sam

  6. #6
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Going into the database and manually creating permalinks for each article solved the problem for me as well. Aren't bugs annoying?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •