Displaying 20 results from an estimated 3000 matches similar to: "KISS and DRY? Not even close!"
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 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 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
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 02
2
Dynamic form tags
Hi all,
I''m happily using "HowToReuseEditViewsForNewViews" found at:
http://wiki.rubyonrails.com/rails/pages/HowToReuseEditViewsForNewViews
There''s this comment there saying you only need the tag "<%= auto_form %>"
when using the code below. Can somebody tell me if that will work when
extending it with model_name (some how)?
I have several new_*
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 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/>
<%
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!
--
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 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
2006 Jan 03
3
Engine and controller layout confusion
Hi all,
Installed the login_engine which is working. But I''m confused as to how I tell
Rails to use the "/app/views/layout" rhtml files, when partials from the
login_engine are used from "/vendor/plugins/login_engine/app/views/user".
Do I copy login.rhtml to /app/view/mgmt?
(mgmt is a controller name in my app)
Along the same line:
I also have a nil error on the
2005 Dec 23
8
webrick / winxp won''t stop serving cached file??
Hi
Working through the tut material in teh PP book (agile dev with rails)
on a laptop running winxp.
Creating the "admin" application, things generally work great. Except:
at teh end of chapter 6, when we update teh css to improve the look of
the page - I copy the new scaffold.css into my working directory, but
webrick keeps serving the old css, even after a restart. Very odd. The