Skip to content

Instantly share code, notes, and snippets.

# The problem: In your Rails 3 project, you have a model Request that models a
# user's request for content related to a specific problem or topic. The user
# can tag her request with any number of words. These are modeled by a Tag class
# backed by a tags DB table. Since you want unique records per tag, you have a
# Tagging class backed by a taggings table. Taggings is a a many-to-many table
# with some additional information. Also, other models in the application
# besides requests can be tagged: The Tagging class defines a polymorphic
# relationship "taggable" with those models.
#
# So pretty soon you want to look up all the requests that are tagged with
@adamonduty
adamonduty / gist:4348505
Created December 20, 2012 20:59
Jruby ArrayList multiple assignment
Current behavior:
$ irb
jruby-1.7.1 :001 > require 'java'
=> false
jruby-1.7.1 :002 > java_import 'java.util.ArrayList'
=> [Java::JavaUtil::ArrayList]
jruby-1.7.1 :003 > a = ArrayList.new
=> #<Java::JavaUtil::ArrayList:0x12910b0b>
jruby-1.7.1 :004 > a << 1 << 2