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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:06:04+00:00 2026-05-22T16:06:04+00:00

Have some time I’m stuck in this problem. I’m trying to pass 3 Id’s

  • 0

Have some time I’m stuck in this problem. I’m trying to pass 3 Id’s through a form to save the data in my database.

def new
  @person = Person.find(params[:person])
  @honored = Person.find(params[:honored])
  @group = Group.find(params[:group_id])
  @honor = Honor.new
end

def create
  @person = Person.find(current_person)
  @honor = Honor.create(:group => Group.find(params[:group_id]),
           :person => Person.find(params[:person]),
           :honored => Person.find(params[:honored]))
 if @honor.valid?
  flash[:success] = "Honor created."
  redirect_to (:back)
 else
  redirect_to (:back)
 end
end

In my view where I call the new method:

<% @asked_groupmembership.each do |agm| %>
<%= link_to "Create Honor", new_honor_path(:group_id => @group.id, :person => current_person.id,
  :honored => agm.member.id) %> 

My forms:

<% form_for @honor do |f| %>

 <%= f.hidden_field :group_id, :value => @group.id %>
 <%= f.hidden_field :person, :value => current_person.id %>
 <%= f.hidden_field :honored, :value => @honored.id %>

 <div class="field">
<%= f.label :texto %><br />
<%= f.text_field :texto %>
 </div>

When I click the submit button I get this error:

Couldn't find Group without an ID

app/controllers/honors_controller.rb:22:in `create'

{"utf8"=>"✓",
 "authenticity_token"=>"C7wofMY4VcyfdS10oc3iglex8nZVBMQ0Nh22nMiaOqs=",
 "honor"=>{"group_id"=>"39",
 "person"=>"2",
 "honored"=>"44",
 ...
                },
 "commit"=>"Insert"}

How can I solve this?
Thanks.

##EDITED##

class Honor < ActiveRecord::Base
  belongs_to :person, :class_name => 'Person', :foreign_key => "person_id"
  belongs_to :honored, :class_name => 'Person', :foreign_key => "honored_id"
  belongs_to :group, :class_name => 'Group', :foreign_key => "group_id"
  • 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-22T16:06:05+00:00Added an answer on May 22, 2026 at 4:06 pm

    You need to update your create method with:

    def create
      @person = Person.find(current_person)
      @honor = Honor.create(:group_id => params[:honor][:group],
               :person_id => params[:honor][:person],
               :honored_id => params[:honor][:honored])
     if @honor.save
     ...
    end
    

    Because after submitting your form you got your data in params[:honor]. You can see the hash passed to the controller in the code posted in your question:

    "honor"=>{"group"=>"39",
     "person"=>"2",
     "honored"=>"44",
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some time defined from my database, and this is how it looks:
I have spent some time now to solve a problem for which i have
I have for some time build n-tier Applications using a database server as the
I have some records like this: ID Personel_Code Time --- ------------- ------ 1 0011
Quite some time i`ve learnt MVC. I have seen various techniques to post data
First of all, I have some time reading this page and I find very
I have some time-series data that I'm fitting a loess curve in ggplot2, as
On my page I have a lot of textpages and to save some time.
I've been wondering about this for some time. In CouchDB we have some fairly
I have for some time tried to anthropomorphise (meaning human readable) the names I

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.