similar to: ActiveRecord without an associated model

Displaying 20 results from an estimated 20000 matches similar to: "ActiveRecord without an associated model"

2006 Jan 23
8
OT: Problem rotating logs with lighttpd
Hi everybody, this is a little OT. We are using Lighttpd as a webserver for Rails. Our problem is that when we rotate the logs everyday at the end of the process, lighttpd stops writing the logs. To solve this we have to restart the server manually each time. We use a common Debian, lighttpd-1.4.7, Rails 1.0 and fcgi-2.4.0. I have tracked the lighttpd bugs, and I haven''t found
2006 Feb 05
0
Database Querry without a Object or Model associated with it
I have a need to connect to a separate database in order to get some information from that DB but I am trying to figure out the most elegant way to do it. With this application there will be times when a new DB will be added to the mix and I would rather not have to add models to my app every-time a new database is added. I could do it this way if that is how everyone tells me to go, but
2009 Apr 29
0
Polymorphic comments table needs associated model
Howdy, I''ve been banging my head on this problem for a bit. I''m using the acts_as_commentable plugin which works great. The scenario, I''m on the user''s dashboard and want to display comments with commentable_type = Venue. No problem. But, if I want to display the name of that Venue with the comment... big nasty. The polymorphic key is a composite key and
2006 Dec 14
3
Problem with ActiveRecord and Associations
Hi, I''m having what I believe to be a typecast problem with ActiveRecord and Associations. In the code below, I need to flag a contact record for deletion if the contact doesn''t have any addresses or books records: sql = "select id, delete_flag from contacts where id = #{params[:id]}" contact = Contact.find_by_sql(sql) if (contact[0].addresses.count +
2008 May 30
9
find_by_sql without a model? how to do this?
Hi, I''d like to do a "find_by_sql" without a model (e.g. <model name>.find_by_sql("...")) as the results I get back are a once off special, and I''m happy to handle them as an array. How do I do this? "ActiveRecord::Base.find_by_sql(...)" does not seem to work? Background - At the moment I''m doing within a model <model_name>,
2005 Jul 28
0
ActiveRecord, computed values, and associations
Is there some sort of good pattern for dealing with computed values with Rails/ActiveRecord? A simple example: 3 tables, classes, students, and student_class_records (habtm style relation but contains a good deal of additional state so is modeled explicitly) Something like select the 10 classes with the most students. Easy enough in SQL. So I''m using a lot of find_by_sql and
2006 Jun 23
0
Engine controllers are read twice
In all our engines, the app/controllers/*_controller.rb are read twice during application startup, resulting in undesirable side effects, such as duplicated before and after filters. We have post a ticket in the Rails Engine tracking system [1], but we are doubting if it is also reasonable to post it in Rails Trac, because, althought de engine has its own controllers, filters are Rails features.
2006 May 31
0
How to know that a plugin is loaded
Hi! We are developing an application in which the plugin acts_as_taggable can be loaded or not. So we need to know if the plugin is loaded in order to call the acts_as_taggable function en the model definition. We have found a not so elegant solution: class Post < ActiveRecord::Base acts_as_taggable if defined? Tag .... end That is, check if the class Tag (a class that creates the
2012 Jul 06
1
Request: temporal windows
Dear list, I am looking for different window functions used in perceptual audio coding. In the mp3 format, these windows overlap with each other, but I haven't found any information about their mathematical expression, nor their numerical values (see attached document). Which temporal windows are used in ogg audio coding? Thank you very much in advance. Kind regards, ------ Fernando A.
2011 Aug 25
3
ActiveRecord searching in batch (with find_by_sql)
I have an issue where I am getting a large number of records from the database and I cant afford to keep it in the memory due to performance issues. Therefore using the following would be ideal, User.find_each(:batch_size => 5000, :start => 2000) do |user| NewsLetter.weekly_deliver(user) end however, I would like to use find_by_sql since my query is user defined. Question is, is it
2006 May 05
1
Help with ActiveRecord
Model: class AdminQueue < ActiveRecord::Base set_table_name ''adminqueue'' end Interacting with it in script/console >> AdminQueue.new => #<AdminQueue:0x240a910 @attributes={"topic_id"=>nil, "resolved"=>nil, "updated_on"=>nil, "action"=>nil, "type"=>nil, "post_id"=>nil,
2006 Jan 16
2
ActiveRecord: table name with spaces?
Howdy. I''m trying to work with a legacy SQL Server database where some of the table names have spaces in them. I''ve done set_table_name "tablename with spaces", but I can''t get find(:all) to work. I get the following error (because apparently it''s not putting [ ] around the name as is required for SQL Server for names with spaces.
2006 Nov 04
0
Problems with ActiveRecord, Oracle adapter, find_by_sql, multi-table join - ORA-04043 error
Hi all, Windows XP Oracle 10g client OCI8 0.1.16 Ruby 1.8.5 Rails 1.1.6 I''m hitting weird behavior with the Oracle adapter and a find_by_sql call on a multi-table join. The SQL looks like this: SELECT DISTINCT e1.ip_address, loc.street, loc.city, loc.state FROM schema.net_element ne, schema.equipment e1, schema.equipment e2, schema.building b, schema.cust_loc cl, schema.location
2016 Dec 21
2
Modificación de ejes con ggplot
Hola, Estoy haciendo unas gráficas de evolución temporal con el paquete "ggplot" y me he encontrado con una dificultad que no logro resolver. En el eje "x" tengo las fechas y en el "y" la concentración de un parámetro. En el eje x me sale de forma predeterminada intervalos en años (de 2012 a 2016), y unicamente salen 3 etiquetas (una cada 2 años). Necesito
2012 Jan 18
5
graficos con fechas
Buenas tardes: A la hora de hacer unos graficos en el eje de las X tengo fechas en formato ad.Date (''aaa-mm-dd'', por ejemplo 2011-25-07) y el problema es que no me las considera como tales, sino como factores, y no tiene en cuenta la diferencia entre fechas a la hora de separar las barras entre si (por ejemplo, la distancia entre el 6 de julio y el 8 de julio es la misma que la
2013 Dec 17
1
ActiveRecord and tiny_tds
Hi, I''m having some issues trying to run .find_by_sql against a Win MSSQL 2008 server. When I use the tiny_tds gem the query works without any issues. require ''rubygems'' gem ''tiny_tds'', ''= 0.6.2'' require ''tiny_tds'' gem ''activerecord'', ''= 3.2.12'' require
2006 Jun 18
3
ActiveRecord Help - Not finding Data
Hello, I''m farily new to RoR and am having a problem trying to retrieve data from my database. Here is the code from my controller: def index zip = params["zip"] @zip1 = Zipcode.find(:first, :conditions => ["zip = ?", zip]) lat = @zip1.latitude.to_f long = @zip1.longitude.to_f radius = 50 @bookstores = Bookstore.find_by_sql ["SELECT * FROM
2006 Mar 21
0
Nested One-To-Many ActiveRecord Question
I have a set of one-to-many relationships, nested 4 deep. In other words: table_A has_many table_B, table_B belongs_to table_A, has_many table C, table_C belongs_to table_B, has_many table D, table_D belongs_to table_C Now, I want to to find on table_A, based on criteria in table_D, and I want to paginate it. And I need fields from all four tables in the result set. Does anyone know
2005 Jul 11
0
anyone using ENCODE and DECODE in SQL in ActiveRecord?
I keep some sensitive information encoded using MySQL''s ENCODE and DECODE commands in the database table. -- example SQL: SELECT *, DECODE(ccnumblob, ''salthere'') AS ccnum FROM customers WHERE id=2; UPDATE customers SET ccnumblob = ENCODE(''4321432143214321'', ''salthere'') WHERE id=2; INSERT INTO customers (name, ccnumblob) VALUES
2007 Sep 26
0
activerecord multiple databases
So, I was looking for a setup that would allow me to easily query multiple databases and not have to re-write my customer finder type queries. Here is what I came up with and it seems to be working for me in my very basic tests so I thought I''d share. Just posting it in case this helps anyone else trying to do the same thing. I''m using this with activerecord, but not rails, so