Archive for the ‘ruby’ Category

PDF Writer must be marshal-able for simple table to work

Sunday, March 23rd, 2008

This one had me stumped for a while, I was getting errors like

can't dump File

C:/dev/ruby/current/lib/ruby/gems/1.8/gems/transaction-simple-1.4.0/lib/transaction/simple.rb:132:in `dump'
C:/dev/ruby/current/lib/ruby/gems/1.8/gems/transaction-simple-1.4.0/lib/transaction/simple.rb:132:in `start_transaction'
etc.

Which were thrown when rendering a table in PDF Writer. It turns out that the whole pdfwriter object needs to marshal-able and mine wasn’t. I had inherited pdf writer and added a logging function to help debug some other issues


def logger
@logger ||= Logger.new "#{RAILS_ROOT}/log/debug.log"
end

@logger was now storing a reference to a file which wasn’t marshal-able so it broke the siple table render_on getting rid of the class object (@logger ||= ) fixed the problem even though it made the logging less efficient.

rdt update breaks radrails

Thursday, April 19th, 2007

I updated my RDT plugin (version 0.9.0.200704141430RC1) in eclipse this morning and it broke my radrails servers and rake tasks.

My log file looked something like

!ENTRY org.eclipse.core.jobs 4 2 2007-04-19 11:38:16.345
!MESSAGE An internal error occurred during: "Update rake tasks".
!STACK 0
java.lang.NoClassDefFoundError: org/rubypeople/rdt/internal/launching/RubyRuntime
at org.radrails.rails.internal.core.RailsRuntime.rubyExec(RailsRuntime.java:95)
at org.radrails.rails.internal.core.RailsRuntime.rubyExec(RailsRuntime.java:181)
at org.radrails.rails.internal.ui.raketasks.RakeTasksHelper.getTasksText(RakeTasksHelper.java:94)
at org.radrails.rails.internal.ui.raketasks.RakeTasksHelper.getTasks(RakeTasksHelper.java:68)
at org.radrails.rails.internal.ui.raketasks.RakeTasksView$4.run(RakeTasksView.java:192)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)

Reverting to my previous configuration (’Help’ > ‘Software Updates’ > ‘Revert to Previous’) worked like a charm so I’ll wait until the Aptana crew release an update for Radrails as well.