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 6613019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:10:04+00:00 2026-05-25T20:10:04+00:00

So, this is really a Rails pattern question. I have a Rails 3.0.9 application

  • 0

So, this is really a Rails pattern question.

I have a Rails 3.0.9 application that works, and well. We’re using Airbrake to detect and report errors, and that’s helped tune the last few leaks in the program design.

Only, now it gets attacked by robots (Google, crawlers, etc) with bad input.

ActiveRecord::StatementInvalid: PGError: ERROR: invalid input syntax for integer: 
"google_ads_dbg" LINE 1: ....message_thread_id WHERE "message_threads"."id" = 
'google_ad... ^ : SELECT "message_threads".* FROM "message_threads" INNER JOIN    
"message_thread_users" ON "message_threads".id = "message_thread_users".message_thread_id 
WHERE "message_threads"."id" = 'google_ads_dbg' AND (("message_thread_users".user_id = 
33899)) LIMIT 1

The restful routes:

resource :inbox do
  resources :messages
end

The first line of the MessagesController#show

@message_thread = current_user.message_threads.find(params[:id])

Do I prefix every .find params[:id] call to validate the integer-ness of the input? Do I tack-on :constraints => {:id => /[0-9]+/} to every resource line in my routes.rb ?

  • 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-25T20:10:04+00:00Added an answer on May 25, 2026 at 8:10 pm

    You can supply the constraints for multiple resources at once.

    scope :constraints => { :id => /\d+/ } do
      resources :inbox do
        resources :messages
      end
    end
    

    This makes most sense to me. You could validate the integer in before-filters in your controllers, but I think that’s a messy alternative given your situation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a really simple Rails application that allows users to register their attendance
I'm using Ruby on Rails to develop a web application. I have a wiki
(This is really a newbie question about Rake & Rails & dependencies in general.
I have an app that is using devise for authentication. Rails 3 on ruby
I couldn't really find this in Rails documentation but it seems like 'mattr_accessor' is
This really, really urks me, so I hope that someone can give me a
I've got this really simple piece of code that I thought was the correct
I've been having this really annoying thing happen the past few days, that has
I have a feeling someone is going to point me to another question that
I have a rails application and I have all the jQuery scattered out in

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.