November 2011

JRuby and Polyglot

JRuby 1.5.6 (I know. Old) Rails 3.0.1 Polyglot 0.3.3 UPDATE: see easier fix below Getting the following error when bundling: {% highlight ruby %} Java::JavaLang::ArrayIndexOutOfBoundsException: An error occured while installing polyglot (0.3.3), and Bundler cannot continue. Make sure that gem install polyglot -v ‘0.3.3’ succeeds before bundling. {% endhighlight %} JRuby YAML parser is erring with this version of...

Rails, nested attributes and before_save callbacks

I had a Project model with a many ProjectWell (as in oil) association. Taking advantage of the accepts_nested_attributes, I was able to persist both Project and ProjectWell attributes through a single web form. {% highlight ruby %} class Project < ActiveRecord::Base has_many :project_wells accepts_nested_attributes_for :project_wells end class ProjectWell < ActiveRecord::Base belongs_to :project end {% endhighlight %} Now, the ProjectWell...