[Rails] Re: Printing nested data to screen

2011-07-28 Thread Andrew Skegg
Barney bsperlin@... writes: And a relevant section of index.html.erb is: %= @people.each do |person| % tr ... td%= person.zip_code %/td td%= person.skill_set %/td td%= WHAT GOES HERE TO BE ABLE TO PRINT THE position FIELD OF THE employee_infos TABLE? WHAT CHANGES SHOULD

[Rails] Re: Printing nested data to screen

2011-07-25 Thread Barney
Hi Andrew and Curtis, I've been away for 3 days but have come back to the problem above. As things have continued to be difficult I have backed off keeping things well normalized and have crunched the people_skills table, with its 3 fields of: skill, competency and years of

[Rails] Re: Printing nested data to screen

2011-07-21 Thread Barney
Hi Andrew, Currently show works from the listings page but new and edit don't. The current people_controller is: def show @person = Person.find(params[:id]) @people_skills = PeopleSkill.all @people_skill = PeopleSkill.select('skill').where({person_id = @person.id})

[Rails] Re: Printing nested data to screen

2011-07-21 Thread Barney
Hi Eric, Well, I couldn't make the objects work: @people_skill = @person.skill wasn't accepted. I'll keep trying and any suggestions are appreciated. Barney On Jul 19, 10:30 pm, Eric Hu e...@lemurheavy.com wrote: The original code didn't work because Barney was generating an

[Rails] Re: Printing nested data to screen

2011-07-21 Thread Barney
Hi Eric, Well, I couldn't make the objects work: @people_skill = @person.skill wasn't accepted. I'll keep trying and any suggestions are appreciated. Barney On Jul 19, 10:30 pm, Eric Hu e...@lemurheavy.com wrote: The original code didn't work because Barney was generating an

[Rails] Re: Printing nested data to screen

2011-07-21 Thread Barney
Hi Eric, Well, I couldn't make the objects work: @people_skill = @person.skill wasn't accepted. I'll keep trying and any suggestions are appreciated. Barney On Jul 19, 10:30 pm, Eric Hu e...@lemurheavy.com wrote: The original code didn't work because Barney was generating an

[Rails] Re: Printing nested data to screen

2011-07-21 Thread Andrew Skegg
Barney bsperlin@... writes: The people_controller.rb#edit, which doesn't work, is: def edit @person = Person.find(params[:id]) @people_skills = PeopleSkill.all @people_skill = PeopleSkill.select('skill').where({person_id = @person.id}) respond_to do |format|

Re: [Rails] Re: Printing nested data to screen

2011-07-21 Thread Curtis Schofield
I still can't help feeling you are experiencing these issues because you are starting to swim upstream against the rails conventions. One of the unspoken conventions being violated is putting Queries in the Controller - :( If you are still having difficulty, please post you model logic

Re: [Rails] Re: Printing nested data to screen

2011-07-20 Thread Eric Hu
The original code didn't work because Barney was generating an ActiveRecord Relation. The .find almost worked, except he wanted to embed Ruby code in a SQL statement. This should do it: PeopleSkill.where(people_id = #{@person.id}).find In the future, I think something like Andrew's suggestion

[Rails] Re: Printing nested data to screen

2011-07-19 Thread Barney
Thanks Andrew, but I couldn't make the 'find' work on the 'PeopleSkill.where...' line. When I used 'find' on the @people_skill line it came very close (since in the controller, listed above, people_skill was already choosing the field 'skill'), so when I used: %= @people_skill.find(@person.id)

[Rails] Re: Printing nested data to screen

2011-07-19 Thread Andrew Skegg
Barney bsperlin@... writes: Thanks Andrew, but I couldn't make the 'find' work on the 'PeopleSkill.where...' line. When I used 'find' on the @people_skill line it came very close (since in the controller, listed above, people_skill was already choosing the field 'skill'), so when I used: