From: Ferhat A. <fer...@ya...> - 2008-01-20 00:55:47
|
Hi, I think I have an idea whats going wrong. I'm binding the arrangedObjects of ActiveRecordSetController to NSTableView column (usual stuff). But this is interesting: the decimal column (in my case the price of product) is the problem. I used an NSNumberFormatter in the table column cell to confirm this. And, indeed, I got this error: OSX::OCException: NSInternalInconsistencyException - Cannot create number from object <RBObject: 0x228b3b0> of class RBObject I think RBObject is in this case not the right type, is it? If I do not bind the price column, everything work fine. Is this a bug or am I just poor of knowledge? Thanks, Ferhat ----- Original Message ---- From: Ferhat Ayaz <fer...@ya...> To: rub...@li... Sent: Saturday, January 19, 2008 7:35:50 PM Subject: Re: [Rubycocoa-talk] NSProxy doesNotRecognizeSelector:copyWithZone: Hi Eloy, thank you for your reply. I'm trying to access an already existing database created by a rails application. The migration for the products table looks like this create_table :products do |t| t.column :title, :string t.column :description, :text t.column :image, :string t.column :price, :decimal, :null => false, :precision => 8, :scale => 2 t.column :asset, :decimal, :null => false, :precision => 8, :scale => 2 t.column :accepts_contract, :boolean, :default => true t.column :rank, :integer t.column :manufacturer_id, :integer t.column :created_at, :datetime t.column :updated_at, :datetime end (There are also other tables which I don't care for my rubycocoa application) Although there is a manufacturer_id, I didn't generate Manufacturer.rb using the generate.rb script (hint). This is really everything I've done. The following line causes the exception @products = Product.find(:all).to_activerecord_proxies If I try to use the first version without active_record, say: @products = [] everything is ok. The kvc_accessor :products is bind to the contentArray of an ActiveRecordSetController. RubyCocoa Version: 0.12.0 Thanks. Ferhat ----- Original Message ---- From: Eloy Duran <elo...@gm...> To: rub...@li... Sent: Saturday, January 19, 2008 7:02:44 PM Subject: Re: [Rubycocoa-talk] NSProxy doesNotRecognizeSelector:copyWithZone: Hi Ferhat, Unfortunately that error is too much of a general problem to be able to diagnose for me. Could you try to get some more detailed info on which code is causing the problem? Cheers, Eloy On 18-jan-2008, at 22:59, Ferhat Ayaz <fer...@ya...> wrote: Hi, I'm trying to run an activerecordsupport application. I have added an ActiveRecordSetController ArrayController in IB and set the class name properly (in my case ProductProxy). here my simple controller code (inspired by the blog article by Eloy Duran) require 'osx/cocoa' class CNController < OSX::NSWindowController kvc_accessor :products def init if super_init ActiveRecord::Base.establish_connection({ :adapter => 'mysql', :host => 'localhost', :username => 'root', :password => '', :database => 'xyz_development' }) @products = Product.find(:all).to_activerecord_proxies return self end end end I have generated product.rb and product_proxy.rb using the handy generate.rb script. So, the error message I get is the following [Session started at 2008-01-18 22:51:02 +0100.] /Users/ayaz/Projects/CNClient/build/Debug/CNClient.app/Contents/Resources/rb_main.rb:24:in `NSApplicationMain': NSInvalidArgumentException - *** -[NSProxy doesNotRecognizeSelector:copyWithZone:] called! (OSX::OCException) from /Users/ayaz/Projects/CNClient/build/Debug/CNClient.app/Contents/Resources/rb_main.rb:24 The Debugger has exited with status 1.The Debugger has exited with status 1. Any idea? Thanks! Ferhat Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Rubycocoa-talk mailing list Rub...@li... https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk Never miss a thing. Make Yahoo your homepage. ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs |