search for: quote_column_name

Displaying 15 results from an estimated 15 matches for "quote_column_name".

2010 Mar 30
2
remove_index missed quote_table_name
in lib/active_record/connection_adapters/abstract/schema_statements.rb there is a missing quote_table_name in line 286 (def remove_index): execute "DROP INDEX #{quote_column_name(index_name(table_name, options))} ON #{table_name}" so my "keys" table can get an index with "add_index" but can''t remove it (without tweaking) replacing it to execute "DROP INDEX #{quote_column_name(index_name(table_name, options))} ON #{quote_table_name(...
2006 Apr 17
7
MySQL backticks and column names
The upgrade to Rails 1.1 hurt my ability to run tests because it generated the following MySQL error: Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''key ON config (key)'' at line 1: CREATE UNIQUE INDEX key ON config (key) I have a table called `config` with a column
2007 Oct 09
5
Backticks wrapping SQL values in polymorphic associations...
Hopefully the subject line didn''t scare you. That said... I have a simple polymorphic relationship (is that possible?): class Part has_many :attachments, :as => :attachable end class Attachment belongs_to :attachable, :polymorphic => true end Calling Part.find(:first).attachments yields this SQL error: ActiveRecord::StatementInvalid: Mysql::Error: Unknown column
2009 Sep 28
5
Multi-databases support
Hi, While I was hacking ovirt-server, I have found that it's currently restricted to Postgres DB. Even if I like postgres for serious work on a server, I really prefer to hack/dev locally on a Sqlite or MySQL DB. I have googled on rails in order to find a good answer for the "foreign key problem" which forces OVirt to stay on pg. I have found a plugin on this particular
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/.
2010 Dec 14
4
Change primary_key column name
Hi, after changing a primary key column name, the auto-increment information (MySQL) and sequence (Oracle) are lost. What is the correct way to rename primary keys? Thanks, Gustavo -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2008 Sep 03
5
Eager load associations in Oracle problem with more than 1000 records
I think Rails 2.1 introduced a bug when eager loading of associations with Oracle. In 2.1 ActiveRecord loads the included table with a big ''IN'' query: ''where association.id in (1, 2, 3, 4...)''. The problem is that Oracle has a hard limit of 1000 values in an IN clause. I get this error: ''OCIError: ORA-01795: maximum number of expressions in a list
2006 Jun 23
0
help... can''t run ActiveRecord unit tests to test bug fix
...ling reserved words correctly if one is used as a column name. Example Migration: self.up drop_column :some_table, :condition end MySQL allows the use of reserved words as column names provided they are quoted using the backtick. This is actually handled properly elsewhere in AR via the #quote_column_name method (in mysql_adapter.rb), but this method isn''t used in #add_column or #drop_column. cr
2006 Aug 17
1
find_by_contents fails with :include option
..... FROM foos LEFT OUTER JOIN bars ON bars.foo_id = foos.id WHERE (id in (1)) REBUILD YOUR INDEX! One of the id''s didn''t have an associated record: 1 --- Error should probably log a better message too... Quick way to fix it: 313: conditions = [ "#{table_name}.#{connection.quote_column_name(''id'')} in (?)", id_array ] I don''t know if it''s the perfect fix, but it works for me. Cheers, Aaron -- Posted via http://www.ruby-forum.com/.
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 Jan 09
3
rails ignoring the migration file
I have a mysql database that I am trying to use migrations on. The problem that I am having is that when I create a blob field in my migration file like so: t.column "data", :binary, :limit => 15.megabytes, :null => false rails changes it to this in the schema: t.column "data", :binary, :default => "", :null => false not only is this not what I wanted
2005 Oct 17
8
Using active record for SELECT MAX(column) FROM ...
Hi, Is there an easy way of querying an active record for a maximum column value? I need to do queries like: SELECT MAX(salary) FROM employees TIA, Jeroen
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:
2006 Jan 01
11
Migration db_schema_import always fails.
I have not been able to get DB migrations to work at all in Rails 1.0 for me. On multiple platforms I continually get the same errors. It took me awhile to figure out some initial things, such as Migrations don''t seem to support Enum column types, and doesn''t really support Foreign key relationships (the constraints at least). After changing my DB schema to jive more with the
2009 Nov 09
3
How can I improve a Ruby on Rails code that hast a lot of SQL as strings?
Hello Railists, I have a piece of Ruby on Rails code that has a complex SQL query (well, not that complex, but as far as I know beyond the ORM capabilities) and for my taste it has too many strings and harcoded values. I''d like to improve it as much as possible, so my question is open ended, what else can I do to improve it? Some particular issues I have - Is there a way to get a table