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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:47:28+00:00 2026-05-27T00:47:28+00:00

RoR is famous for being convention over configuration, so it’s likely that my question

  • 0

RoR is famous for being “convention over configuration”, so it’s likely that my question is off — I don’t know the convention I should be following.

I have 2 model objects, ParseException and ParseResolution, and ParseResolution belongs_to ParseException.

I am simply making an admin panel off of the Rails scaffolding, and I want to add a new ParseResolution object, tied to a ParseException object.

After generating controllers for both models, I added a link to parse_resolution/new from parse_exception/index. Since ParseResolution needs to know which ParseException it is resolving (belongs_to), I am also passing it as a parameter:

<td><%= link_to 'Add Resolution', new_parse_resolution_path(:parse_exception => parse_exception) %></td>

So far so good.

In my ParseResolution controller, I have:

def new
  @parse_resolution = ParseResolution.new
  @parse_resolution.parse_exception = ParseException.find(params[:parse_exception])

  respond_to do |format|
    format.html # new.html.erb
    format.xml  { render :xml => @parse_resolution }
  end
end

So far so good, as I can access the ParseException object inside my ERB file and display its details.

However, when I press the “Create” button to add my new ParseResolution object, the save method complains that I’m not providing it with a ParseException, which is a required column.

I tried doing this with a hidden_field:

<%= hidden_field(:parse_resolution, :parse_exception) %>

But that just converts the actual ParseException object into a string:

<input id="parse_resolution_parse_exception" name="parse_resolution[parse_exception]" type="hidden" value="#&lt;ParseException:0x1108a8930&gt;" />

Which clearly won’t work.

OK, so I’m trying again not to hate Ruby on Rails for all of its voodoo-like convention. Would someone please enlighten me on the best way to do what I am trying to do?

  • 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-27T00:47:29+00:00Added an answer on May 27, 2026 at 12:47 am

    If you want follow good practices, you should do something like this:

    Your routes to new,create,destroy action should looks like:

    parse_exceptions/:parse_exception_id/parse_resolutions/new
    

    in routes.rb it gonna be:

      resources :parse_exceptions do
        resources :parse_resolutions
      end
    

    and then your path to new action should be something like that:

    new_parse_exception_parse_resolution_path(@parse_exception)

    (you also need to change path to create action in form)

    Then in your ParseResolutionsController:

    before_filter :load_parse_exception
    .
    def new
      @parse_resolution = @parse_exception.parse_resolutions.new
    end
    
    def create
      @parse_resolution = @parse_exception.parse_resolutions.new(params[:parse_collection]
      .
      .
    end
    private
    def load_parse_exception
      @parse_exception = ParseException.find params[:parse_exception_id]
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ROR newby question: I've got a controller with the following action: # GET /organisations/new
Simple RoR question...I am learning ROR and am making a simple voting app. The
I am developing RoR application that works with legacy database and uses ActiveScaffold plugin
I'm following the RoR 3 Rails Tutorials, but to upgrade to a newer version
My RoR server receives a string, that was encrypted in C++ application using des3
I'm new to RoR; I want create the following statement. I've an array; I
I am making a RoR site that is delivered in several languages, and want
Anyone know why RoR isn't serving the CoffeeScript correctly? in my application view: <%=
I'm new to RoR/Gems, this is a basic question. I created a gem, MyNameGem,
I am trying an ror tutorial and I came across the following line of

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.