similar to: HOWTO: Combine fields from 2 two tables in 1 object

Displaying 20 results from an estimated 1000 matches similar to: "HOWTO: Combine fields from 2 two tables in 1 object"

2006 Jan 10
15
KISS and DRY? Not even close!
Hi all, After working on my first rails app and having handed over some very sophisticated coding from a lot of you guys. My app does what I want it to do, but I''m no where near the end yet, and it seems that the KISS and DRY objectives already went down the drain. It could be lack of knowledge, only doing Ruby on (and) Rails for a month, but I''m stuck on the following:
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 =
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
Hi all, Im working on a copy contact info into project method. Nosing aroundwith IRB I see a hex value. Named Contact:0x40ca01cc #<Contact:0x40ca01cc @attributes={"name"=>"GP-net", "id"=>"7", "lastname"=>"Petersen", "firstname"=>"Gerard"}> Why is it there like that and not in a human readable
2006 Jan 08
4
ID from child table not handled by AR
Hi all, Im slowly moving forward, but there''s something a miss. I can save some relational records to tables, but only once. For an 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
2005 Dec 31
7
Dynamic form? Not really!
Hi guru''s out there, Im happilly coding my first rails app, and all goes well. I find myself manually coding in a particular field all the time (company_id), that relates the contact to a company. The total coding of this form seems somewhat much. Could somebody tell me what Rails power I''m possibly missing and stuborn as I am trying to do myself? I was wondering if the
2006 Jan 28
3
DRY conflict with "Updated at" "Created at" "Deleted at" in view
Hi all, Are there any helpers or so for listview routines that suppres the three above mentioned columns? I''m currently exploring something like the code below. But it feels like I''m doing Rails'' work. # just for test purposes <div id="debug"> <% for col in Product.columns.map %> <%= col.name %> - <%= col.type %><br/> <%
2005 Dec 30
3
NewbieQ - Relational tables
Hi all, I''m going nuts on a very simple issue. I know what I want but don''t know what to tell rails to do so. I have a very common setup for managing contacts. A companies table and a contacts table. As you''ve guessed it''s a one to many relationship. The database is setup with the appropriate foreign keys, the models have been generated and I added the
2006 Jan 13
1
How to disconnect to a database????
Hi, We have experienced some problems with ActiveRecord::Base class of Ruby-Rails. We are building a web-application based on the Ruby-rails framework and the web-application needs to access to difference databases, so we do not pre-define our database accesses in the database.yml file. In fact, we are using the ActiveRecord::Base.establish_connection() to connect to our database, the function
2006 Jan 15
7
Include extra partial in layouts
Hi all, Does anybody know how to include a partial (next to @content_for_layout) in a layout file? I''m looking for a something like @partial_for_include => ''filename'' in my layout files. So a linked .rhtml file gets picked up from within a layout file. All my layout files (4 at the moment) have a <div class="navright"> tag, so one change in the
2006 Jan 03
3
Can I map 2 tables into one class
Can I map 2 tables into one class? Is there any pattern, e.g. using ActiveRecord aggregation? Thanks Szczepan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060103/fa2aed7c/attachment.html
2006 Jan 17
14
Going nuts on ''\n'' to <br />
Hi all, Is there no way to easily resolve this. It can''t be that I''m the first that wants this, and it wouldn''t be RoR if it''s not possible. On the mysql prompt with the select description from todos .. linefeeds are show, so they are there. This is the actual contents with a linefeed after the ":" "Project contacts: delete table, point
2006 Jan 02
5
NoobyQ: how to work with a table of static lookup data??
Hello out there! Nooby question: What''s the "Rails" way to work with tables of relatively static lookup data? Objectively (I''m thinking); I don''t want to hit the DB each time, so for each lookup table, initialize a globally available hash with lable/value pairs... Am I on the right track? How would you do this kind of thing in Rails? Thanks! --
2006 Jan 04
5
check if a file exists?
Hello all! I have a list of people on a page, and some of this people have pictures of them stored on the web server. So I have an image tag like this on my page: <%= image_tag "/images/people/" + person.pers_id.to_s + ".jpg" %> But not all have a picture, so if the file for pers_id=1899 does not exist, i would like to display a custom image for that guy. How can I do
2006 Jan 01
9
Child record becomes orphan
Hi all, I''ve got these company (has) contacts relational tables. I want to make sure a company can''t be deleted when it still has contacts. (because I can now, which results in nil like errors when listing the contacts ... obviously) Are there any helpers to do so, is Rails aware of this? Or do I need to put in a condition before destroying the company record in question
2005 Dec 23
5
Can''t get data from products into @order
I went throught the "agile web developemnt with rails" and Now I''m trying to ''enhance'' the code with some extra options. When I go to admin/shipping I want to include some data from the products table in with the order info listed. I can''t seem to get this to work. in my partial form I''m trying to add this: <td
2006 Jan 02
9
Generating nice tables
Making tables in templates is pretty easy, except for one minor problem. They tend to be fairly ugly. If you have a model with three attributes, it''s very easy to create an html table that looks like this.. Col1 Col2 Col3 A B D A B E A C F A C G Which becomes difficult to read when you have a lot of repeated data. What I would really like to generate
2005 Dec 30
3
model - controller always one-on-one?
Hi All, Is it necessary to always have a controller per model? Rephrased: Would you end up jumping through hoops in the future if you have a controller called Customer in which you add methods to create new companies as well as new contacts? Thanx Regards, Gerard. -- "Who cares if it doesn''t do anything? It was made with our new Triple-Iso-Bifurcated-Krypton-Gate-MOS
2006 Jan 22
3
Formatting input/output of a text box
Hello, What''s the best way to handle formating of a text_area? I have a text_area in my rails app where people can leave comments and I''d like to automatically convert the line breaks into <br /> tags, or just simply wrap a whole paragraph in <p></p> tags. I''m currently doing the following in my comments controller to insert line breaks when the user
2005 Dec 29
7
Laszlo on Rails kicking off
The Laszlo on Rails effort, bringing the rich web interface of OpenLaszlo (http://openlaszlo.org) to the simplicity of Rails (http://www.rubyonrails.com) will be kicking off next week. We have a list going at http://groups.google.com/group/laszlo-on-rails/ -- 88 people so far and we haven''t even begun! -- but if you really want to be close to the action, email me with your firstname,