Re: [jruby-dev] saved model object ID always 1 with jruby-rack

2012-02-20 Thread Vivek Pandey
Thanks Nick and Lance! For now I am going back to 1.2.1 till its fixed. thanks again, vivek. On Fri, Feb 17, 2012 at 7:15 AM, Nick Sieger wrote: > Looks like this is the commit that regressed. > > > https://github.com/jruby/activerecord-jdbc-adapter/commit/ff14f8d3f626450f3f99bf1d2161254724c51

Re: [jruby-dev] saved model object ID always 1 with jruby-rack

2012-02-17 Thread Nick Sieger
Looks like this is the commit that regressed. https://github.com/jruby/activerecord-jdbc-adapter/commit/ff14f8d3f626450f3f99bf1d2161254724c514c3 Unfortunately a change was made that increased compatibility with newer versions of Rails but broke Rails 2.x. I'll commit changes to add back the func

Re: [jruby-dev] saved model object ID always 1 with jruby-rack

2012-02-17 Thread Lance Ball
Thanks Charlie I hope to poke this more today. But a quick data point. The problem exists with activerecord-jdbc-adapter-1.2.2 but not in 1.1.3. Lance On Feb 17, 2012, at 8:00 AM, Charles Oliver Nutter wrote: > This looks promising: > > http://stackoverflow.com/questions/1915166/how-to-get-th

Re: [jruby-dev] saved model object ID always 1 with jruby-rack

2012-02-17 Thread Charles Oliver Nutter
This looks promising: http://stackoverflow.com/questions/1915166/how-to-get-the-insert-id-in-jdbc - Charlie On Thu, Feb 16, 2012 at 5:54 PM, Lance Ball wrote: > FWIW, I've narrowed it down to this code in ActiveRecord::Base#create > >        self.id = connection.insert(statement, "#{self.class.

Re: [jruby-dev] saved model object ID always 1 with jruby-rack

2012-02-16 Thread Lance Ball
FWIW, I've narrowed it down to this code in ActiveRecord::Base#create self.id = connection.insert(statement, "#{self.class.name} Create", self.class.primary_key, self.id, self.class.sequence_name) The call to insert is always returning 1 - at least in the successful case. TBH,

Re: [jruby-dev] saved model object ID always 1 with jruby-rack

2012-02-16 Thread Lance Ball
I have run into this issue as well. I have not yet dug into a fix, but have been able to reproduce the problem with a simple script that uses activerecord 2.3.11 on jruby 1.6.5. Here is the source: https://github.com/lance/pk_sequence_test Here is the output: $ bundle exec pk_sequence_test.rb

Re: [jruby-dev] saved model object ID always 1 with jruby-rack

2012-02-15 Thread Vivek Pandey
Sure, will do but first I am going to re-produce this with a simpler script. thanks, vivek. On Tue, Feb 14, 2012 at 11:26 PM, Charles Oliver Nutter wrote: > I will echo Nick's suggestion: reproduce in a simple script. If we can > narrow it down to a simple schema and script, the fix may be eas

Re: [jruby-dev] saved model object ID always 1 with jruby-rack

2012-02-14 Thread Charles Oliver Nutter
I will echo Nick's suggestion: reproduce in a simple script. If we can narrow it down to a simple schema and script, the fix may be easy to find. My money is on auto-generated ID not propagating back out properly during #save. Feel free to open an AR-JDBC issue at this point: https://github.com/j

Re: [jruby-dev] saved model object ID always 1 with jruby-rack

2012-02-14 Thread Nick Sieger
If using "rackup" on JRuby causes the same problem, then Warbler/JRuby-Rack should be able to be ruled out. Can you reproduce the issue with a small script or in the console? On Feb 14, 2012, at 4:33 PM, Vivek Pandey wrote: > that might be the case atleast from pure observation. My rubymine doe

Re: [jruby-dev] saved model object ID always 1 with jruby-rack

2012-02-14 Thread Vivek Pandey
that might be the case atleast from pure observation. My rubymine does not let me step inside ActiveRecord::Base.save() with jruby rack:( It does not look like anyone on this list has experienced this problem, that tells me maybe its some other dependencies or something else causing it. This is pre

Re: [jruby-dev] saved model object ID always 1 with jruby-rack

2012-02-14 Thread Charles Oliver Nutter
Ahh, that's interesting. So perhaps there's something in save that should be getting a generated ID and we're not doing that right? - Charlie On Tue, Feb 14, 2012 at 2:36 PM, Vivek Pandey wrote: > Jruby rackup fails the same way, which is the persisted model object id is > shown as 1 instead of

Re: [jruby-dev] saved model object ID always 1 with jruby-rack

2012-02-14 Thread Vivek Pandey
Jruby rackup fails the same way, which is the persisted model object id is shown as 1 instead of its actual value. I ran it thru debugger and right after product.save(false) product.id gives 1 and if I do Product.find_by_name(), it gives me the just persisted object correctly. vivek. On Tue, Feb

Re: [jruby-dev] saved model object ID always 1 with jruby-rack

2012-02-14 Thread Nick Sieger
How about rackup on JRuby? Works or fails? /Nick On Tue, Feb 14, 2012 at 9:43 AM, Vivek Pandey wrote: > Sorry, forgot to give my env. Running my env on rails is non-trivial at > present. All I can tell is that when I run rackup with MRI it all works well > but the same when warbled and deployed

Re: [jruby-dev] saved model object ID always 1 with jruby-rack

2012-02-14 Thread Vivek Pandey
Sorry, forgot to give my env. Running my env on rails is non-trivial at present. All I can tell is that when I run rackup with MRI it all works well but the same when warbled and deployed on tomcat, gives me the id of 1! Something must be silly going on here not sure what. thanks, vivek. JRuby 1

Re: [jruby-dev] saved model object ID always 1 with jruby-rack

2012-02-14 Thread Charles Oliver Nutter
Hi Vivek! On Tue, Feb 14, 2012 at 8:15 AM, Vivek Pandey wrote: > Hi, > > I am using JRuby with Sinatra and ActiveRecord as ORM. I have code such as > this: > >      ActiveRecord::Base.transaction do >         product.rollback_active_record_state! do >           if(product.save(false)) >          

[jruby-dev] saved model object ID always 1 with jruby-rack

2012-02-14 Thread Vivek Pandey
Hi, I am using JRuby with Sinatra and ActiveRecord as ORM. I have code such as this: ActiveRecord::Base.transaction do product.rollback_active_record_state! do if(product.save(false)) logger.debug "Prod ID: #{product.id}" yield if block_given?