similar to: Passing an SQL fragment in AR save

Displaying 20 results from an estimated 500 matches similar to: "Passing an SQL fragment in AR save"

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
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:
2013 Feb 08
4
convert 12 time stamp to 24 hour
Readers, For a 12 hour time stamp: > testtime<-("2013-01-01 01:00:01 PM") > testtime [1] "2013-01-01 01:00:01 PM" > testtime24hour<-strftime(testtime,'%H:%M:%S') > testtime24hour [1] "01:00:01" how to convert to 24 hour format so that the object 'testtime24hour' is: '13:00:01' Thanks. -- r2151
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
2013 Oct 16
2
Plot time series data irregularly hourly-spaced
Dear all, I have a time series of data that I would like to represent in a plot. But I am facing some problems to do it because the time is represented in "hours", it can start in one day and end in another day, and it is not regularly spaced. My problem is that when I plot my data, my X-axis always starts from the lower values of my time data. For example, I would like to plot data
2008 Mar 03
1
Tapply for Group Specific Means and Proportions
UseRs, I am working on a dataset (see small example below) where individuals were followed on a specific date-time combo and multiple repeated measurements were taken (e.g., height in meters, behavior class in 2 letter code). Observation numbers varied between individual (ranging from 1 observation for each date-time combo to >50) I am trying to summarize the data into 1 row per
2009 Aug 21
1
trouble with Vista & reading files
All, I am having trouble with a "read.table()" function that is inside of another function. But if I call the function by itself, it works fine. Moreover, if I run the script on a Mac OS X (with the default Mac OS X version of R installed, rev 2.8), it works fine. But it does not work if I run it on windows vista (also default Windows version of R, rev. 2.8). Again, both
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
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
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
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 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
2007 Nov 14
1
has_many_polymorphs and acts_as_list ?
First, BRAVO for this wonderful plugin: has_many_polymorphs ! Now my problem: 4 models : Collection, Page, Fragment, Belonging (which is the join table): 1 class Collection < ActiveRecord::Base 2 has_many_polymorphs :elements, 3 :through => :belongings, 4 :from => [:pages, :fragments, :collections], 5 :as => :collector, 6 :parent_order =>
2008 Sep 25
1
defining polymorphic type condition
As great as Rails 2.1 is, I for the life of me cannot figure out why polymorphic associations do not support reconfiguring the type column used. For example, I have no way to do a polymorphic association using a lookup hash which maps an integer to a class name. Storing a TINYINT unsigned is waaaaay more efficient than storing a string like "SomeActiveRecordModel" over and over again.
2011 Sep 13
4
Changing adapters in ActiveRecord does not change the generated sql
If I establish a new connection with a new adapter (ie. switch from mysql to postgresl) the generated sql is still mysql specific. I tried all sorts of reset methods on AR::Base but to no avail. There must be something being memoized on ActiveRecord base that has to do with the adapter and it doesn''t get cleared when you establish a connection with a new adapter. I know this
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
2007 Mar 01
3
Ajax.PeriodicalUpdater using Effect.Highlight to highlight newly loaded div
Hi folks. So far I have managed to get dataloading into a div froma php script. This script just passes the time on the server in a div to the javascript below. I am trying to get the last loaded data to call Effect.Highlight but it seems to highlight the 2nd last data instead. Can anyone see what''s going wrong here? I''ve tried everywhere to solve this. Check the code in action
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
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,