Displaying 6 results from an estimated 6 matches for "quoted_comma_pair_list".
2006 Feb 28
0
ActiveRecord: Legacy primary keys
..._key)
return self.id
end
EOS
end
def self.content_columns
@content_columns = columns.reject { |c| c.name =~ /(_id|_count)$/ ||
c.name == inheritance_column }
end
def update
if !@new_id
sql = "UPDATE #{self.class.table_name} " +
"SET #{quoted_comma_pair_list(connection,
attributes_with_quotes(false))} " +
"WHERE #{self.class.primary_key} = #{quote(id)}"
else
sql = "UPDATE #{self.class.table_name} " +
"SET #{quoted_comma_pair_list(connection,
attributes_with_quotes(false))} " +
"...
2009 Mar 03
2
Passing an SQL fragment in AR save
I have a basic model class TestTime with no customization.
class TestTime < ActiveRecord::Base
end
I would like to pass the following SQL fragment as part of an AR save
call to TestTime objects. How and where would I do this in the model?
"set c_time=current_time"
(current_time is an SQL method, not a variable).
--
Posted via http://www.ruby-forum.com/.
2006 Feb 27
4
2 belongs_to to the same parent table
Hello!
I have 2 table: users and buddies
User: id, name, ...
Buddy: id, user_id, user_buddy_id, ...
So if you have 2 users 1,jack and 2,fred and fred is a buddy of jack,
there is a Buddy object: id=1, user_id=1, user_buddy_id=2
I can declare only one belongs_to in Buddy and one has_many in User. And
there is conflict if I had the second one (the first one is discarded)
class User
has_many
2010 Apr 20
13
why is ActiveRecord tying to select nonex ID column?
I''ve loaded (and updated) thousands of these MeteredUsage records. In
the middle of a run, I suddenly get:
ActiveRecord::StatementInvalid: Mysql::Error: Unknown column ''id'' in
''where clause'': UPDATE `metered_usages` SET `cost` = 12603.46 WHERE `id`
= NULL
I can''t see anything that''s different about this particular record
compared to
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/.
2009 Jan 11
6
Why does ActiveRecord allow perception of success when updating an ID, however it doesn't really work(i.e. no change in database)?
Hi,
Why does ActiveRecord allow perception of success when updating an ID,
however it doesn''t really work(i.e. no change in database)?
Here''s an example. The update of "id" versus update of a non-existent
attribute.
?> ai = AccountItem.find(:first) => #<AccountItem id: 1, account_id: 1,
date: "2009-01-11", amount: