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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:16:00+00:00 2026-05-28T20:16:00+00:00

I’m developing a Rails app that does some plotting behind the scenes to generate

  • 0

I’m developing a Rails app that does some plotting behind the scenes to generate a Comparison between various datasets. What I’m seeing is a sporadic 500 error (ActionView::Template::Error) on generation of the Comparison object in my DataMapper database. It only happens sometimes on one machine, every time on another machine, and never on one. These errors correlate with the performance of the computer, leading me to believe that DataMapper is doing something weird behind the scenes.

I’ve given up on chasing down the ‘why’ and am now just trying to catch the 500 error and force a refresh to prevent the reviewers from seeing the problem. However, everything I’ve tried hasn’t worked. Here’s my setup:

comparisons_controller.rb

# This is the action which allows for generation of a new comparison.  It uses a fork to spawn a child process which generates the comparison. Notifications will appear when this fails or finishes.  
  def create
    first_set = get_msruns_from_array_of_ids(params[:comparison1].uniq)
    second_set = get_msruns_from_array_of_ids(params[:comparison2].uniq)

    comp = Comparison.new
    comp.msrun_firsts = first_set
    comp.msrun_seconds = second_set
    comp.first_description = params[:first_description]
    comp.second_description = params[:second_description]
    comp.save

# This should capture the windows fork and prevent it.
    if RbConfig::CONFIG['host_os'] === 'mingw32'
      redirect_to :action => "show", :id => comp.id
      result = comp.graph
      a = Alert.create({ :email => false, :show => true, :description => "DONE WITH COMPARISON #{comp.id}" })
    else
      fork do
        result = comp.graph
        a = Alert.create({ :email => false, :show => true, :description => "DONE WITH COMPARISON #{comp.id}" })
      end
      flash[:notice] = "Comparison started. You will be notified when it completes."
 # HERE I've attempted to capture problem 
      begin 
        render :action => "show"
      rescue 
        redirect_to :action => "show", :id => comp.id
      end 
    end

This shows up in my production.log file:

ActionView::Template::Error (undefined method `first_description' for nil:NilClass):  
    1: /- @comparison ||= Comparison.get(params[:id])
    2: /%h1= "Comparison ##{@comparison.id}"
    3: %p <strong>User Description: </strong>
    4: <p> Set#1: #{ @comparison.first_description }
    5: <p> Set#2: #{@comparison.second_description }
    6: <p> #{link_to "Edit", edit_comparison_path(@comparison)}
    7: %ul.categories
  app/views/comparisons/show.html.haml:4

This error has been bothering me for weeks, but has not yielded to me. Any ideas on the why or the how to catch the error and force a refresh?

Thanks.

  • 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-28T20:16:01+00:00Added an answer on May 28, 2026 at 8:16 pm

    You shouldn’t be loading @comparison inside your view, that’s the responsibility of the controller. You’ve also commented out the line that actually assigns @comparison so it’s hardly surprising it’s evaluating as nil.

    Remember that on create there is no :id parameter at all. This might explain why it only works on a redirect when finally you have that information available.

    What you probably meant was this:

    @comparison = Comparison.new
    

    This will define the variable for use inside your views regardless of the parameters.

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

Sidebar

Related Questions

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
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I need to clean up various Word 'smart' characters in user input, including but
Does anyone know how can I replace this 2 symbol below from the string

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.