similar to: Only iterating over the middle content_columns?

Displaying 20 results from an estimated 7000 matches similar to: "Only iterating over the middle content_columns?"

2006 Jan 03
0
Automatically mapping content_columns?
Hi all, Quick setup - I''ve got a table Foo. Foo has a foreign key (bar_id) to the table Bar. The Bar table has an "id" and "name" column. Assume a 1:1 relationship. The issue I''m trying to resolve (or rather, be lazy about) is with regards to Foo.content_columns. By default it doesn''t pickup the foreign key. What I''m wondering is if
2006 Mar 03
0
Does content_columns hold related data from other tables?
I''ve got a belongs_to / has_many relationship working, however I don''t know if I can still use content_columns (or any other shortcut) in my view that displays my object. E.g., Employee belongs_to Department I''m displaying an Employee. Will content_columns contain employee.department.name? Or how else could I do this so I don''t have to hard-code column
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 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
2006 Apr 27
2
"for column in..." not picking up _id columns
My code executes fully: <% for column in ModelName.content_columns %> <th><%= column.human_name %></th> <% end %> but it does not pick up any columns in my model''s table that end in "_id". Is this by design? Is there a helper method that will reference the related tables? Or will I need to code the column titles and detail records by
2005 Sep 17
1
Export to Excel
I need to export some data to an Excel file and found a reference in the HowTo section of the Rails Wiki. Followed it to the letter: added "export" action to controller, copied export.rxml and changed in accordance to model. When I call the export action I keep getting "undefined method `content_columns'' for #<Employee". The ActiveRecord mention content_columns
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 Feb 01
4
Where is the send() function?
Hi, in the tutorial "4 Days on Rails" the following code fragment is used: ,---- | <% for column in Category.content_columns %> | <td><%=h category.send(column.name) %></td> | <% end %> `---- Apparently, the send() function returns the column value by name, but where does this function comes from? Unfortunately, neither the tutorial nor the API
2006 Aug 18
3
Understanding MVC - view customization after using scaffolds
All, I have ordered AWDWR and am anxiously awaiting its arrival. In the meantime I still am playing with ROR using radrails. I have a few questions ... I create a table named customers with the following details: Field Type Null Key Default Extra id int(11) NO PRI auto_increment customer_name varchar(50) NO inbound_retention int(11) NO outbound_retention int(11) NO unix_admin_email
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 Jan 27
17
Multiple Model Validation
Hey All ! I have a form which contains two models. I would like both models to be validated, but have their validations aggregated on the page. If I do: <%= error_messages_for(:model1) %> <%= error_messages_for(:model2) %> It puts two big validation blocks on the page. I would like all the errors from both models, but only in one validation box. Is this possible ? All my attempts
2006 Mar 14
4
What does the send() method do on a model object?
All, I did a scaffold for a model and I ended up with this code in list.rhtml: <% for column in TargetList.content_columns %> <td><%=h target_list.send(column.name) %></td> <% end %> Where is the "send" method and what does it do? I can''t find it on ActiveRecord::Base? I assume that it returns a value based on the column id but I
2006 Jan 23
5
Bibtex database design
I am working a Bibtex database for my school using Rails and I need some idea on how to manage the bibtex types. I crated an Author and Publications model and put has_and_belongs_to_many relationship between them. The user model basically is like this: class User < ActiveRecord::Base has_and_belongs_to_many :publications end The Publication model has all the Bibtex fields
2008 Mar 12
3
undefined method `each' for #<Usrecart:0x46d1678>
I have the an error such as undefined method ''each'' pls can any one find the error from the code given below <center><%=@b%></center> <center><h2>WELCOME IN YOUR PROFILE</h2> <%@usercart=Usrecart.find_by_user_id(@b)%> <%if @usercart.blank?%> <br> <br> <br> <br> <h2>THERE IS NO
2006 Mar 08
2
Displaying related tables in forms.. probably an easy question!
Hey All, I have two tables.. One belongs to another. Why can''t I reference table1.table2.attribute? Specifically, using scaffolding: property.rb - has_one :PropertyType property_type.rb - has_many :Properties property_controller - def list @property_pages, @properties = paginate :properties, :per_page => 10 end list.html: 1. <% for property in @properties %> 2.
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 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 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/
2007 Dec 17
3
not able to view the images after the upload
hi, i have this problem where in i''m able to upload the images using file_column to the server but i''m not able to view the images.i''m not able to see the images but then i''m able to view the image name when i click on my show action. can any one please help?? THIS IS MY LOG as to what happens when i do the image upload. Processing UploadController#create
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