similar to: Weird ActiveRecord Foreign Key Problem

Displaying 20 results from an estimated 2000 matches similar to: "Weird ActiveRecord Foreign Key Problem"

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 Jun 22
11
Help please
Getting this error: SyntaxError in CompanyController#positionslist (eval):1:in `compute_type'': compile error (eval):1: parse error, unexpected tINTEGER Object::2 I could not find anything out about it (googling) and it''s not the clearest error message. Not sure if it''s related to an expected data type but that wouldn''t make sense. The only other thing I can
2007 Aug 22
3
tackle memory insufficiency for large dataset using save() & load()??
Hello List, i have been agonizing over this for days, any reply would be greatly appreciated! Situation:___________________________________ My original dataset is a .csv dataset (w/ 2M records) with 4 variables: job_id (Primary key, won't be used for analysis, just used for join tables), sector_id (categorical variable, for 19 industry sectors), sqft (con't variable for square
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 +
2006 May 11
0
Handling instantiate_without_callbacks
Hi, I''m writing this app with inheritance. I''m using the type column to store the class name. Another app scans the app and performs actions. However, it is possible that the second app does not implement a class, in which case, the superclass should be instantiated. Now I''m getting: /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/
2005 Dec 12
2
How to use arbitrary relationships in Activerecord
How can I ask ActiveRecord to make it''s "has_many" code to work on some arbitrary relationship between two tables? ie neither field is a primary key The situation is that I am writing a Postfix management application and one of the tables to manage is the "alias" table. My primary key in the "mailbox" table is "id", but the alias table is just
2007 Aug 08
5
and_yield + instance_eval(&block)
I have the following code, which yields instance eval''s the block given: class Foo def bar(&blk) instance_eval &blk end def baz yield end end The effect of this is that self is reassigned: Foo.new.bar do # here, self is the instance of Foo # created by new end But normally self is the object in which Foo.new.bar {...} occurs. Foo.new.baz do
2006 Jul 08
1
Need Help Understanding Situation with Table Columns
I am trying to create an application loosely based on the Depot application presented in Agile Web Development with Rails (AWDwR). I am using InstantRails for the server. In my app I have the folowing controllers: admin_controller application_controller city_map_controller (with method: displayGMap) The admin_controller was created with the following command: ruby script/generate scaffold
2005 Nov 07
5
Switchtower deployment
Hi, Has anyone experiences using SwitchTower (Windows) in a shared hosting environment (Textdrive)? I already patched the SwitchTower rake tasks (I don''t know if someone is interested on it), but i still experience some problems (not in the sudoers list, ...). Thank you for answer (and thank you to the textdrive guys, i never had a such fast support!) -- Jean-Etienne Durand
2007 Sep 27
10
Adding more sugar to wxSugar
Hi all, New wxRuby event handling offers the choice between using blocks or methods seamlessly and easily. This is great respectively for simple app and more complex app. Nevertheless, currently the creation of an application, a frame, or a dialog is very tedious for simple app : - you need to create a subclass of Wx::App, Wx::Frame ... - you need to put the initialization code in the initialize
2006 Feb 10
1
instance_eval and Proc objects
Hi All, Got a bit of a Ruby question for you. If I have a function that makes a proc object like this: def select(selector, &proc) el = Element.new el.instance_eval proc end select("#thing") do hide end Wat I want to do is evaluate the Proc in the context of el but this doesn''t work because instance_eval accepts a string or a block and not a Proc object. I sense
2006 Jun 06
0
Scaffolding Extension - Polimorphic Associations
When I try to use it with polimorphic associations I get the following error In browse action: activesupport-1.3.1/lib/active_support/dependencies.rb:100:in `const_missing'': uninitialized constant Privable activerecord-1.14.2/lib/active_record/base.rb:1246:in `compute_type'' activesupport-1.3.1/lib/active_support/dependencies.rb:131:in `const_missing''
2006 Jun 26
1
ActiveRecord, instance_eval, and PStore
I''m trying to add some per-object behaviors to objects descended from ActiveRecord, by using after_initialize() and instance_eval(), like this: def after_initialize self.instance_eval(File.read(''customers/default.rb'')) end (Ultimately the file path will be dynamic, this is just proof of concept.) default.rb just contains a few method definitions like this one: def
2006 Aug 18
9
Rails is doing what I want - but I don''t understand how.
Hi guys, I have the strangest thing happening. The funny part is its doing exactly what I want to do, I just don''t understand how. Basically here is my model. class Role < ActiveRecord::Base has_and_belongs_to_many :users has_and_belongs_to_many :rights def self.names names = Array.new() for role in Role.find :all names << role.name end return
2006 Dec 14
8
ActiveRecord outside of rails
I have a few questions regarding using activerecord outside of rails. Usage is with legacy databases, which gives rise to some of the problems. Probably the first, and most simple question though, is how to capture the SQL log, with which I can hopefully figure the other stuff out. I''m currently trying ActiveRecord::Base.logger = Logger.new STDOUT Based on random googles, but it
2006 Jul 05
2
Serialized object behaves weird
Hi! I got a class named EinsatzFilter which I serialized to session. Before saving to session it works afterwards I keep getting the message: "undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from ActiveRecord::Base inherited class. Code: class EinsatzFilter include ApplicationHelper attr_reader :personen, :monat, :projekte, :kunde
2006 Dec 21
1
need some guidance with a test
This is part of a rails project. The following method is part of the Ams class (a rails model). I''m a bit unsure of the rspec/bdd way of testing this method. def persist_as_domains @current_domains.each do |d| dom = Domain.new dom.domain = d dom.source_id = 1 dom.at = Time.now dom.save end end The following is what came out when I tried to write my test. Notice
2007 Jan 24
3
Another ''found a bug'' problem - This time with user purging.
Ok, given the statement on the web page about unlesssystemuser under Resources ( http://reductivelabs.com/projects/puppet/documentation/typedocs.html#resources), I assume that users can be purged. However, when I attempt to do this with resources { user: purge => true, noop => true } and what I get is: err: Found a bug: private method ''split'' called for nil:NilClass.
2011 Jun 02
10
Application Error!!!!!!!!!!!!!!!!!!!!!!!
Hi everybody, Please any one help me, Previous two day''s I am googling, Still not find solution. this really frustrating. I had deploy my app on heroku http://radiationn.heroku.com/. it is working fine on localhost but i got APPLICATION ERROR. IN log wht i find that in photo.rb model not able to find "has_attached_file", I am not able to shout out this proble. It working
2009 Sep 10
2
passenger with ruby enterprise edition
Hi I am failing to start apache2 with ruby enterprise edition and passenger 2.2.5 [Wed Sep 09 17:38:20 2009] [notice] Apache/2.2.11 (Ubuntu) mod_ssl/2.2.11 OpenSSL/0.9.8g Phusion_Passenger/2.2.5 configured -- resuming normal operations *** Exception LoadError in PhusionPassenger::Rack::ApplicationSpawner (no such file to load -- puppet) (process 16544): from