Displaying 5 results from an estimated 5 matches for "contacts_list".
2006 Jan 10
15
KISS and DRY? Not even close!
...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_name, t2.id from companies AS t1, contacts AS t2 where t1.id =
t2.company_id order by t1.name'')
@contacts_list = @contacts_list.collect { |c| [ c.name + " - " + c.first_name
+ " " + c.last_name,...
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
2006 Jan 08
4
ID from child table not handled by AR
...eeded 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'')
## Showing a nice dropdown list with "Company - Fname Lname"
## Thanx to Chris Hall
@contacts_list = @contac...
2006 Jan 09
2
catch id from form and copy between objects
Hi all,
Not completely sure what I''m doing, but I need to get data from another table
based on and id. Below is some breakpointer output:
irb> @params
=> {"project"=>{"project_description"=>"point2", "project_name"=>"break2"},
"action"=>"create_project",
2006 Jan 06
2
IRB hex values
..."=>"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 + " " + c.lastname, c...