search for: projectcontact

Displaying 6 results from an estimated 6 matches for "projectcontact".

Did you mean: project_contact
2006 Jan 10
8
Noob: Child records not saved
Hi all, happily coding along, but it seems a belongs_to record is not saved. # Create some stuff def create_project @contact = Contact.new @project = Project.new(@params[''project'']) @project_contact = ProjectContact.new(@params[''collect'']) @project.project_contact = @project_contact contact = Contact.find(@params[''id''][''collect'']) # Copy fields @project.project_contact[''firstname''] = contact["firstname"] @project.project_co...
2006 Jan 06
2
IRB hex values
...ttributes={"name"=>"GP-net", "id"=>"7", "lastname"=>"Petersen", "firstname"=>"Gerard"}> Why is it there like that and not in a human readable way? -- Method: @project = Project.new @project_contact = ProjectContact.new @contacts_list = Contact.find_by_sql(''select t1.name, t2.firstname, t2.lastname, t2.id from companies AS t1, contacts AS t2 where t1.id = t2.company_id order by t1.name'') @project_contacts = @contacts_list.collect { |c| [ c.name + " - " + c.firstname + " &q...
2006 Jan 08
4
ID from child table not handled by AR
...ERT INTO project_contacts ... The field that holds the foreign key (project_id) is set correct btw. What''s eventually needed is to copy contact info from another contact table all together. Some info: ## Models: class Project < ActiveRecord::Base has_one :project_contact end class ProjectContact < ActiveRecord::Base belongs_to :project end ## Controller Methods def new_project @project = Project.new @contacts_list = Contact.find_by_sql(''select t1.name, t2.firstname, t2.lastname, t2.id from companies AS t1, contacts AS t2 where t1.id = t2.company_id order by t1.name'&...
2006 Jan 09
2
catch id from form and copy between objects
...he one I want is the ''6'' in "id"=>{"collect"=>"6"} The irb output is right after the form submission. The following statements are executed @contact = Contact.new @project = Project.new(@params[''project'']) @project_contact = ProjectContact.new(@params[''collect'']) breakpoint What needs to be done is catch some fields and copy them based on the id. @project_contact.firstname = @contact.find_on_id_from_form_somehow.firstname The "find_on_id_from_form_somehow" needs to be replaced with a conditional find ....
2006 Jan 10
15
KISS and DRY? Not even close!
...contacts_list.collect { |c| [ c.name + " - " + c.first_name + " " + c.last_name, c.id ] } render_action ''new_project'' end def create_project @contact = Contact.new @project = Project.new(@params[''project'']) @project_contact = ProjectContact.new(@params[''collect'']) @project.project_contact = @project_contact contact = Contact.find(@params[''id''][''collect'']) @project.project_contact.first_name = contact.first_name @project.project_contact.last_name = contact.last_name if @...
2006 Jan 05
7
HOWTO: Combine fields from 2 two tables in 1 object
Hi all, For a dropdownlist (showing "Company - FirstName Lastname'') I want to fill an object @project_contacts with "Name" from table Companies and "Firstname" and "Lastname" from table contacts. Any idea? Regards, Gerard. -- "Who cares if it doesn''t do anything? It was made with our new Triple-Iso-Bifurcated-Krypton-Gate-MOS