vendredi 14 mars 2014

Ruby module behavior with and without rails


Vote count:

0




I'm trying to use the Matrix module in a Rails app. I wrote some code that works fine as a standalone ruby script, but it fails with an interpretation error when put inside a rails helper.


Here's a snippet of the code:



require 'matrix'
require 'bigdecimal'
require 'bigdecimal/util'

M_thing_OI = Matrix[[1, 0.0, 0.0],
[0.0, 1, 0.0],
[0.0, 0.0, 1]]


The code crashes with ActionController::RoutingError (undefined method '[]' for Matrix:Module):


This same code works entirely fine when placed on its own into a regular ruby script. Any ideas on what could cause this?



asked 2 mins ago

kolosy

1,224





Aucun commentaire:

Enregistrer un commentaire