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

  • SEARCH
  • Home
  • 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 938273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:36:59+00:00 2026-05-15T21:36:59+00:00

Users can view a specific entry in my webapp with a URL. /entry/8 ,

  • 0

Users can view a specific entry in my webapp with a URL. /entry/8, for example. If an entry doesn’t exist, “Entry not found” gets appended to @messages and I render an error page.

I’d like to show some arbitrary query instead of a blank page, but I can’t figure out a good way to keep the error message around to be displayed. There are other actions that need to take place in the arbitrary query’s controller, so I can’t just duplicate the query and render :posts.

Some example code:

module MyApp::Controllers
  class ComplexQuery < R '/query'
    def get
      @entries = Entries.all(:conditions => someComplexConditions)
      until @entries.complexEnough? then @entries.makeMoreComplex! end
    end
  end

  class SingleEntry < R '/entry/(\d+)'
    def get(id)
      @entries = Entries.find_all_by_id(id)
      unless @entries.nil?
        render :posts
      else
        @messages = ["That entry does not exist."]
        render :blank  # I want to run Controllers::ComplexQuery, instead of rendering a blank page.
      end
    end
  end
end
  • 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-15T21:37:00+00:00Added an answer on May 15, 2026 at 9:37 pm

    Something like this?

    def get(id)
      @entries = Entries.find_all_by_id(id)
      unless @entries.nil?
        render :posts
      else
        r *MyApp.get(:ComplexQuery)
      end
    end
    

    See Camping.method_missing.

    But I would also recommend moving ComplexQuery into a helper method:

    module MyApp::Helpers
      def complex_query(conditions); end
    end
    

    Then you can complex_query(something) in both SingleEntry and ComplexQuery.

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

Sidebar

Ask A Question

Stats

  • Questions 531k
  • Answers 531k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I have since figured this out. You need to first… May 17, 2026 at 12:01 am
  • Editorial Team
    Editorial Team added an answer I think this problem doesn't occur now.. May 17, 2026 at 12:01 am
  • Editorial Team
    Editorial Team added an answer Here is a post giving an outline of how they… May 17, 2026 at 12:01 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Can spring Acegi security be used for a social networking application where users can
I have 2 models which look like that: class Entry(models.Model): user = models.ForeignKey(User) dataname
I've got a list view in my MVC app that shows a check box
I'm writing entries for cross-browser bugs/workarounds. I would like the main view to present
I have a rails app with a mobile view using jqtouch. If the application
I have the following module, which affects how users arrive at two different content
We've got some users who would like to query one of our SQL Server
The reason for a second sentence in my question as it can hold any
I don't have a specific question here but I'm more looking for some guidance
I have a View Feedback page with two drop down lists to filter the

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.