Search Results

Search found 1 results on 1 pages for 'synthesezia'.

Page 1/1 | 1 

  • Generating URLs when not using an integer as an id?

    - by Synthesezia
    So I'm building a blog engine which has /articles/then-the-article-permalink as it's URL structure. I need to have prev and next links which will jump to the next article by pub_date, my code looks like this: In my articles#show @article = Article.find_by_permalink(params[:id]) @prev_article = Article.find(:first, :conditions => [ "pub_date < ?", @article.pub_date]) @next_picture = Article.find(:first, :conditions => [ "pub_date > ?", @article.pub_date]) And in my show.html.erb <%= link_to "Next", article_path(@next_article) %> <%= link_to 'Prev', article_path(@prev_article) %> In my articles model I have this: def to_param self.permalink end The specific error message I get is: article_url failed to generate from {:action=>"show", :controller=>"articles", :id=>nil}, expected: {:action=>"show", :controller=>"articles"}, diff: {:id=>nil} Without the prev and next everything is working fine but I'm out of ideas as to why this isn't working. Anyone want to helo?

    Read the article

1