search for: project_contact

Displaying 8 results from an estimated 8 matches for "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"] @p...
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 process ..." My $Grtz =~...
2006 Jan 09
2
catch id from form and copy between objects
.../project"} The 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 co...
2006 Jan 08
4
ID from child table not handled by AR
...unknown reason, the primary key (id) of the child table is not automatically increased. (I can only perform one save, (the first records id field holds the value ''0'') and during the next save it says: Mysql::Error: Duplicate entry ''0'' for key 1: INSERT 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 < Acti...
2006 Jan 10
15
KISS and DRY? Not even close!
...re very complex. And this is not what Rails is about. Does this sound familiar to anybody out there? I''m not going to include my whole app but below is one method that made me come to the formentioned dilema. The models: company (hm) <-> (bt) contacts project (ho) <-> (bt) project_contacts The guilty actions (new_project and create_project) are shown below: (They''re workin, but I don''t even wanna think about the edit/update actions) def new_project @project = Project.new @contacts_list = Contact.find_by_sql(''select t1.name, t2.first_name, t2.last_nam...
2006 Jan 03
0
data modelling
...ng package, I want to create a new project (what''s in a name?). To which I copy contact info, (sub)products like mailbox, hostname webspace. etc. And I want to log my hours into a project as well. I came up with the following prelimenary tables (models if you will) Project has_many: Project_Contacts has_many: Project_Products has_many: Project_Time_items Project_Contacts (records wil be copied from the normal Contacts table) Project_Products (a shopping cart like setup to gather all sub products and copy them in from Products) Project_Time_items (A table with records on what time was spe...
2006 Jan 06
2
IRB hex values
...tact:0x40ca01cc @attributes={"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.firs...
2006 Jan 08
0
Debug on form submission
...form submit? I know there''s IRB, but I don''t know what I''m looking for, so not what to dig up from the console either. Among other thing info related to AR, since this is something I run into: Mysql::Error: Duplicate entry ''0'' for key 1: INSERT INTO project_contacts (`project_id`, `company_name`, `first_name`, `last_name`) VALUES(0, '''', '''', '''') Thanx a lot. Regards, Gerard. -- "Who cares if it doesn''t do anything? It was made with our new Triple-Iso-Bifurcated-Krypton-Gate-MOS process...