I have a table called people_skills linked to a people table by a FK
named people_id.  Trying to get the people_skills fields printed on a
"Show" screen has never given me what I wanted (the field value)
without resorting to a helper which forms an input box.  The people
table's values are printed but the results of the people_skills are
either non-existent or strange (e.g. #<ActiveRecord::Relation:
0x1d12778>).
This is the controller code (people_controller.rb):

 def show
    @person = Person.find(params[:id])

    @people_skill = PeopleSkill.select('skill').where(":people_id =
@person.id")
    show_skill = @people_skill.build.skill
    yrs_exp = @people_skill.build.years_of_experience

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @person, :xml => @peopleskill }
    end
  end

and this is the show.html.erb:

<p>
  <b>Skill</b>
  <%= @people_skill.build.skill %>
  <%= PeopleSkill.where("people_id = @person.id")%>
 </p>

which produced the strange #<ActiveRecord... output above.  Other
guesses have either given me errors or no output at all, so please
tell me the right way to do this.
             Barney

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to