Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7656273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:43:28+00:00 2026-05-31T12:43:28+00:00

I’m running Rails 3.1.1 and getting an odd bug. In development (haven’t yet tried

  • 0

I’m running Rails 3.1.1 and getting an odd bug. In development (haven’t yet tried pushing to production with it) I’m occasionally getting routing errors in my controller or in my mailer template when it tries to generate a url for a newly created record. This happens even though the record is created successfully and appears to have nothing to do with the record properties (I can recreate a record with the exact same params right after and not get the error, it seems totally random when it happens).

It seems to happen maybe one in 10 times, though I can’t say I ever saw an incident of it happening before I added the mailer action.

There’s one more potentially complicating factor: I’m using an encryption method to obfuscate the record’s id in its URL, but this is otherwise working without a hitch. To do this I adapted the method discussed here

It seems to me like the URL’s not generated in time for the link_to call some of the time… But that doesn’t make much sense to me. I didn’t think race conditions were something I needed to worry about here.

Here are my error logs when this happens in the controller (when the params don’t call for an email to be generated):

ActionController::RoutingError (No route matches {:action=>"show", :controller=>"watch_lists", :id=>#<WatchList id: 195, title: "sfdsfd", created_at: "2012-03-19 05:18:46", updated_at: "2012-03-19 05:18:46", public_list: false>}):
  app/controllers/watch_lists_controller.rb:72:in `block (2 levels) in create'
  app/controllers/watch_lists_controller.rb:56:in `create'

And here’s when it happens in the mailer template (when the params do call for an email to be generated before the render command):

Rendered watch_list_mailer/share_notification.html.erb (3.2ms)
Completed 500 Internal Server Error in 113ms

ActionView::Template::Error (No route matches {:action=>"show", :controller=>"watch_lists", :id=>#<WatchList id: 210, title: "sdggsgsg", created_at: "2012-03-19 05:47:17", updated_at: "2012-03-19 05:47:17", public_list: true>}):
    20:             <% end %>
    21:         <% end %><br>
    22:         <br>
    23:         Here's a link to your WatchList: <%= link_to @wl.title, watch_list_url(@wl) %><br>
    24:         <br>
    25:         Enjoy!
    26:     </p>
  app/views/watch_list_mailer/share_notification.html.erb:23:in `_app_views_watch_list_mailer_share_notification_html_erb___1391186431365383285_70156615518000'
  app/mailers/watch_list_mailer.rb:12:in `share_notification'
  app/controllers/watch_lists_controller.rb:124:in `share_notification'
  app/controllers/watch_lists_controller.rb:68:in `block (2 levels) in create'
  app/controllers/watch_lists_controller.rb:63:in `each'
  app/controllers/watch_lists_controller.rb:63:in `block in create'
  app/controllers/watch_lists_controller.rb:56:in `create'

EDIT: Upon further testing, this appears to happen regardless of whether I include the mail task. It seems most likely spurred by the obfuscation of the links. It’s possible that the encoding of the links has something to do with it (I had to make sure to URI-escape them to prevent slashes in the wrong places elsewhere in my code). I’ll investigate this futher and report back.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T12:43:29+00:00Added an answer on May 31, 2026 at 12:43 pm

    It was a problem with the id encryption creating invalid links occasionally and me failing to account for that in early enough in the process.

    In lib/obfuscate.rb

    def uri_encrypt(value)
        URI.escape(self.encrypt(value), Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
    end
    

    In my model

    def to_param
        uri_encrypt(id)
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I am currently running into a problem where an element is coming back from
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.