search for: column_for_attribute

Displaying 13 results from an estimated 13 matches for "column_for_attribute".

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 self.content_columns > column = column_for_attribute(''sometable_id'') &g...
2006 Jun 16
0
column_for_attribute method
I would like to know if there is any good reason why the method columm_for_attribute (in Active Record) is at instance level and not at the class level. I feel it should be at the class level. Maybe I am missing somehting Thanks in advance for your reply Omar -- Posted via http://www.ruby-forum.com/.
2006 Jul 07
5
link_to: link is missing id
I''m using a legacy table, where the unique id is not ''id'' I have a Model class like the following: class Article < ActiveRecord::Base set_primary_key "ARTICLE_ID" end however, using a link_to like the following (modified scaffolding), the link has no id value: <% for article in @articles %> <tr> <% for column in
2008 Mar 03
2
how can i know type of attribute with active record
Hello, In my database, I have a table "products" with attributes : - id - title ->string - desc -> text I use active record, but I don''t know why recover the type of this attribute with active record? I try attributes_before_type_cast but I don''t see the type Can you help me? Excuse for my english (I''am a young student french) -- Posted via
2006 Apr 17
5
Finding out updated fields
Hi, When we update a record via an update form, is there an easy way to find out the fields that have been changed. If the update is successful, i want to display: The following fields have been changed: field-name = new-value ... Thanks, Lantis. -- Posted via http://www.ruby-forum.com/.
2006 Sep 26
0
Bug or Feature?
...nded feature. That bit of code could possibly be rewritten as (completely un tested): ------------------ def execute_callstack_for_multiparameter_attributes(callstack) errors = [] callstack.each do |name, values| klass = (self.class.reflect_on_aggregation(name.to_sym) || column_for_attribute(name)).klass if values.empty? send(name + "=", nil) else begin send(name + "=", Time == klass ? klass.local(*values) : klass.new(*values)) rescue => ex send(name + "=", nil)...
2005 Sep 06
1
US Date Handling in Rails
My application is built on Rails and MySQL. It will only be accepting US formatted dates as input, however both Rails and MySQL are oriented around ISO the format. I know I can convert a good portion of the entries using ParseDate::parsedate but it does not appear this is how the conversion is taking place when data is being transferred from the params hash into model members. Say I have a field
2007 Mar 29
1
ActiveRecord attributes -- strange behavior when adding Array to an element
Hi, I have a database table and associated ActiveRecord model. I was trying to store (temporarily) an array in one of the attribute elements - not to save it, but just so that I can keep some form data in a sensible place. A stripped down version of the problem I''m having is: p = Property.new(:bedroom_count => ["2","3"]) puts p.inspect # ==> will correctly show
2008 Oct 21
6
detecting width overflow in serialized column with mysql
So I''ve got an ActiveRecord model pointing to a MySQL db, with an auto-serialized column ("serialize :columnName"). Thing is, MySQL, depending on how it''s configured (like, by default), has a bad habit of just truncating your data if it''s too wide for the column, with no error raised. Yeah, I can probably reconfigure MySQL and/or my AR connection to it. But
2006 Nov 04
0
Problems with ActiveRecord, Oracle adapter, find_by_sql, multi-table join - ORA-04043 error
...gems/activerecord-1.14.4/lib/active_record/bas e.rb:696:in `columns'' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/bas e.rb:704:in `columns_hash'' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/bas e.rb:1562:in `column_for_attribute'' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/bas e.rb:1801:in `read_attribute'' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/bas e.rb:2067:in `send'' from c:/ruby/lib/ruby/gems/1.8/gems/acti...
2006 Sep 08
1
(Probably Easy) ActiveRecord help needed!
...by/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:696:in `columns'' from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:704:in `columns_hash'' from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:1562:in `column_for_attribute'' from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:1362:in `id'' [the stack continues downward to my own *.rb file] Even if I change the "problem line" to something like puts "#{n.id} with name #{n.node_name}" # problem lin...
2008 Dec 20
9
Upgrade to Rails 2 - problem with "save" (MySQL boolean issue?)
I have been working through an upgrade of my 1.2.6 application to 2.2.2. I am almost there but I have hit a problem with ActiveRecord. Before the upgrade, the following code was working fine. def create_root(administrator) root = create_root_collection(self.pingee_name, administrator,
2008 Jul 10
6
Uppercase all row columns
Hi. I have to convert the contents of all columns to uppercase before creating a row. Is there an easy way to accomplish this so I don''t have to go one column at a time and upcase! it? Thanks. Pepe --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group,