similar to: "for column in..." not picking up _id columns

Displaying 20 results from an estimated 2000 matches similar to: ""for column in..." not picking up _id columns"

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
2005 Dec 30
3
Too many columns for list.rhtml to display on one page
I''ve gone once through the Agile book and am now attempting my own rails app. I''ve created a table named ''volunteers'' with over 15 columns. The problem is the default list.rhtml that is created with the scaffold, shows all the columns. I only want to show 4 of them with the list view. Where would I start to only return a handfull of columns to the
2006 Aug 05
1
Viewer Problem
In a standard scaffold generator, the list.rhtml looks something like this ... <% for column in Book.content_columns %> <th><%= column.human_name %></th> <% end %> How can I modify this code so for each table column add my own name not the "human_name" generated code? -- Posted via http://www.ruby-forum.com/.
2006 Mar 17
4
Noob question about the "show" function
i''ve got a cool app going and it''s getting bigger and bigger, but now i''m trying to customize the show function. i''m using the scaffold code as a base but can''t seem to get anything to look right. i guess i''m confused about how exactly the scaffold code works for the "show" function. any help would be awesome! thanks. jon --
2005 Dec 27
3
myObject.send(column.name) from Agile Development book
I''m studying the Agile Development with Rails book. In the chapter that first sets up the depot application (page 68), there is this bit of code from a view: <% for product in @products %> <tr> <% for column in Product.content_columns %> <td><%=h product.send(column.name) %></td> <% end %> etc... I am trying to absorb both Ruby and
2006 Aug 07
3
character encoding in RoR
Hi, I''m a newcomer to Ruby and to Rails, and am having a problem with character encoding. Now, I know ruby doesn''t handle unicode...but, characters like ? (eacute) and ? (ccedil) are part of the iso-8859-1 charset, so it shouldn''t be a problem, right? But, for some reason, the string functions still seem to hang on those characters. As an example, in a brand new rails
2006 May 01
1
Show/Hide with AJAX
I''m trying to implement a show/hide details function. I have the show part done, but I''m not sure how to get it to hide. My app looks like this so far: View: <%= link_to_remote "Show/Hide", :update => "details", :url => { :action => "show", :id => leif } %> <p id="details"></p> Action: def show @leif =
2006 Sep 29
1
newbie Q: it won't display foreign keys...
I have two tables CREATE TABLE continents ( id int(11) NOT NULL auto_increment, name varchar(255) NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE countries ( id int(11) NOT NULL auto_increment, name varchar(255) NOT NULL, continent_id int(11) NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; I generate scaffolds for country and for
2006 Mar 05
2
Need help understanding Rails magic!
Hi, I''ve just been pleasantly surprised, again, by how much Rails does for me, but I am *really* surprised. Surprised as in "how the heck did that happen?" I''d really like to understand this and would appreciate any help. Big picture... the user is presented with a form that allows them to select one or more check boxes to record their allergies. The form uses the
2006 Jan 25
1
Rails day 2: where is my association?
I?m following along a few tutorials on the web and trying to implement my own example, but I must be missing something because I can?t get has_many or belongs_to to work like I expected. now I have watched all the videos and made a cookbook several times with different interfaces. what I''m looking for is *not* a code snippet to solve something (because I already have that),
2006 Mar 22
3
Something wrong with content_columns
I have a database with a couple of tables. One table called spares has foreign keys in another called equipment. When I create a new record, it is added to the spares table however the list action does not show all the columns in the table. It only shows those columns that are not foreign keys. I am using the default action generated by scaffold for list. Why is that so? Do i need to re-write my
2006 Feb 27
1
Undefined Method Error in View
After messing around with PHP for over a year, I took one look at Ruby on Rails and fell in love. But it''s one of those confused "Men are from Mars, Women are from Venus" type things... I''ve written a method which does find_by_sql to pick a random row from a database. When I call that method I get an "undefined method ''text'' for ..."
2006 Sep 23
8
acts_as_rateable plugin help!
Hello, I am having some trouble figuring out how to use the rateable plugin. i followed as close as the directions located at http://www.naffis.com/blog/articles/2006/08/31/rails-ajax-star-rating-system but i fail at working it. i am getting this error You have a nil object when you didn''t expect it! The error occured while evaluating nil.rating Extracted source (around line #1): 1:
2006 Dec 28
1
Default Scaffolding Gives Errors
This is the default scaffolding for list.rhtml: [code] <h1>Listing <%= @scaffold_plural_name %></h1> <table> <tr> <% for column in @scaffold_class.content_columns %> <th><%= column.human_name %></th> <% end %> </tr> <% for entry in instance_variable_get("@#{@scaffold_plural_name}") %> <tr> <% for
2006 Mar 22
9
Setting empty fields with in_place_editor_field
Hi all! Playing around with in_place_editor_field, I found that when you set a field to be empty, you can''t edit it at all anymore after that. Am I doing something wrong or is this the way it is intended to be? If so, is there any way around that behaviour? Is it just styling? Best regards, Raphael -- Posted via http://www.ruby-forum.com/.
2006 Apr 26
4
How to search in your application?
I''ve got my app running with a table for product set up like the one from the Agiles book and would like to create a page to search those products. Is there a tutorial somewhere I can reference? I''ve gone through the source code for typo and rails-weenie but can''t find all the pieces to make it work on my own app. Else, any help would be greatly appreciated.. --
2006 Jun 01
3
more questions: human_name
One more question: Is there some way to set the human_name of a column? e.g.: human_name for column address1 shouldn''t be Address1 but "Address, line 1". If not, should I make a hash with my custom names? Best regards, -- ---------------------------------------------------------------------- Yannick Majoros http://www.inma.ucl.ac.be/~majoros Informaticien UCL/INMA-MEMA
2006 Jan 11
15
How to use custom url formats?
I''m new to Rails and am trying to use a field called "code" instead of "id" in my URLs. For example, assuming I''ve got a database of motorcycles makes where the codes are "Honda", "Yamaha", "Suzuki", and "Kawasaki", etc. To show the info about Honda I want to use this url: http://www.mysite.com/makes/honda/
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 30
1
how to get column_for_attribute?
Hi all, In the code below I don''t understand: 1. Why I have to prepend overriden method content_columns with "self." to get it working? 2. Why column_for_attribute method is not working (no such method?) even if SomeTable is subclass of ActiveRecord::Base which have public column_for_attribute method? > class SomeTable < ActiveRecord::Base > > def