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

The Archive Base Latest Questions

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

After getting my question solved by Matteo Alessani in Rails – Id can't be

  • 0

After getting my question solved by Matteo Alessani in Rails – Id can't be found in Forms, I noticed that my form isn’t saving the fields I pass.

I will copy here all the piece of code I have from the other question:

Routes:

resources :honors

Model:

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"

Controller:

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.save(:group_id => params[:honor][:group],
           :person_id => params[:honor][:person],
           :honored_id => params[:honor][:honored])
if @honor.valid?
  flash[:success] = "Honor created."
  redirect_to (:back)
 else
  redirect_to (:back)
 end
end

In the view:

<% @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>

And the error is that I can get the ID’s from group and person and the honored one, but nothing that I type in the forms (my attributes are in portuguese so I won’t translate):

 INSERT INTO "honors" ("group_id", "person_id", "honor_id", "texto", "nota", 
 "nivel_habilidade", "comprometimento", "tempo_demora",
 "criatividade", "organicazao", "comunicacao", "trabalho_grupo", "created_at",
 "updated_at") VALUES (39, 2, 44, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 NULL, NULL, '2011-05-26 12:58:56.433510', '2011-05-26 12:58:56.433510')
 RETURNING "id".

Note: the Parameters in log are with the values.

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-22T16:19:37+00:00Added an answer on May 22, 2026 at 4:19 pm

    You have mistake in controller

    def create
      @person = Person.find(current_person)
      @honor  = Honor.new(params[:honor])
      if @honor.save
        flash[:success] = "Honor created."
        redirect_to (:back)
      else
        redirect_to (:back)
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This isn't really a question on a problem; I've solved it my own (after
Update: Ok, after getting past the fact that I did not have MSDTC set
I have designed one sign-up form,in this form after getting all necessary values I
My answer: After getting annoyed, I have found a solution. The problem was indeed
After getting interested in the problem presented in the question I tried to approach
After getting the right answer from this question , I am having another problem
After having solved the problem of getting the editor to launch when there's a
After getting a helpful answer here , I have run into yet another problem:
After getting a struct from C# to C++ using C++/CLI: public value struct SampleObject
In the below code how to remove the hyperlink after getting the innerHTML :

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.