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 <vivek.pan...@gmail.com> wrote:
> 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 14, 2012 at 8:30 AM, Nick Sieger <nicksie...@gmail.com> wrote:
>>
>> How about rackup on JRuby? Works or fails?
>>
>> /Nick
>>
>> On Tue, Feb 14, 2012 at 9:43 AM, Vivek Pandey <vivek.pan...@gmail.com>
>> 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 on tomcat, gives me the id of 1!
>> > Something must be silly going on here not sure what.
>> >
>> > thanks,
>> >
>> > vivek.
>> >
>> > JRuby 1.6.5 with JDK 1.6
>> >
>> > $ bundle show
>> >
>> >  * activerecord (2.3.8)
>> >   * activerecord-activesalesforce-adapter (2.3.6.1 40ab887)
>> >   * activerecord-jdbc-adapter (1.2.2)
>> >   * activerecord-jdbcpostgresql-adapter (1.2.2)
>> >   * activesupport (2.3.8)
>> >   * arel (2.2.1)
>> >   * backports (2.3.0)
>> >   * blankslate (2.1.2.4)
>> >   * bouncy-castle-java (1.5.0146.1)
>> >   * builder (3.0.0)
>> >   * bundler (1.0.21)
>> >   * eventmachine (0.12.10)
>> >   * haml (3.1.4)
>> >   * hashery (1.5.0)
>> >   * hpricot (0.8.6)
>> >   * httpclient (2.2.1)
>> >   * i18n (0.6.0)
>> >   * jdbc-postgres (9.1.901)
>> >   * jruby-jars (1.6.6)
>> >   * jruby-openssl (0.7.5)
>> >   * jruby-rack (1.0.10)
>> >   * json (1.4.6)
>> >   * mail (2.4.1)
>> >   * mime-types (1.17.2)
>> >   * net-ldap (0.1.1)
>> >   * nokogiri (1.5.0)
>> >   * oauth (0.4.5)
>> >   * polyglot (0.3.3)
>> >   * pony (1.4)
>> >   * rack (1.3.4)
>> >   * rack-protection (1.2.0)
>> >   * rack-test (0.6.1)
>> >   * rake (0.9.2)
>> >   * rest-client (1.6.0)
>> >   * rjack-slf4j (1.5.10.0)
>> >   * ruby-openid (2.1.8)
>> >   * rubyzip (0.9.6.1)
>> >   * sinatra (1.3.1)
>> >   * sinatra-activerecord (0.1.3)
>> >   * sinatra-contrib (1.3.1)
>> >   * sinatra-reloader (1.0)
>> >   * soap4r (1.5.8)
>> >   * tilt (1.3.3)
>> >   * treetop (1.4.10)
>> >   * uuidtools (2.1.1)
>> >   * warbler (1.3.2)
>> >
>> >
>> > On Tue, Feb 14, 2012 at 6:53 AM, Charles Oliver Nutter
>> > <head...@headius.com>
>> > wrote:
>> >>
>> >> Hi Vivek!
>> >>
>> >> On Tue, Feb 14, 2012 at 8:15 AM, Vivek Pandey <vivek.pan...@gmail.com>
>> >> 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))
>> >> >             logger.debug "Prod ID: #{product.id}"
>> >> >             yield if block_given?
>> >> >           end
>> >> >         end
>> >> >       end
>> >> >
>> >> >
>> >> > When I execute rackup with MRI 1.8.7p 357, it prints valid Prod ID.
>> >> > However
>> >> > when I deploy the same using jruby-rack/warbler, It always prints 1
>> >> > as
>> >> > product id, however save is successful and persisted correctly in the
>> >> > DB.
>> >> > Its just that I get invalid product id, which is always 1. Anyone
>> >> > knows
>> >> > what
>> >> > might be going on here?
>> >>
>> >> I doubt jruby-rack has anything to do with it. Can you reproduce with
>> >> "rails server"? What versions of everything?
>> >>
>> >> - Charlie
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe from this list, please visit:
>> >>
>> >>    http://xircles.codehaus.org/manage_email
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to