On Wed, Feb 27, 2008 at 9:53 PM, Mike Garey <random...@gmail.com> wrote:
> Hi all, I'm running into a very strange but incredibly annoying
> problem that I just can't seem to solve.
>
> The exception is occurring from a seemingly innocuous line in my code,
> a simple 'logger.warn("some debug information")'.  The backtrace
> follows:
>
> SecurityError (Insecure: can't modify array)
>        
> [RAILS_ROOT]/vendor/rails/activesupport/lib/active_support/buffered_logger.rb:68:in
> `<<'
>        
> [RAILS_ROOT]/vendor/rails/activesupport/lib/active_support/buffered_logger.rb:68:in
> `add'
>        
> [RAILS_ROOT]/vendor/rails/activesupport/lib/active_support/buffered_logger.rb:75:in
> `warn'
>        [RAILS_ROOT]/app/models/order.rb:244:in `process_with_active_merchant'
>        
> [RAILS_ROOT]/vendor/plugins/acts_as_state_machine/lib/acts_as_state_machine.rb:162:in
> `call'
>
> The line in my model class, order.rb, that causes the exception is the
> following:
>
> logger.warn("Processing order with payment gateway")
>
> Now, I could probably just remove the offending log line to fix the
> problem, but this bothers me, since it may point to a larger problem
> that I'm not aware of, which I 'd rather not ignore.  What makes this
> problem even more difficult to solve is that it doesn't happen
> consistently and is very difficult to reproduce.


Rehashing an old message. I found a solution to this a while ago but
never responded to my original message.  Well, better late than never!
 Hopefully this will help someone in the future from wasting the
amount of time that I did.

The problem turned out to be a bug with using self.method(action).call
in acts_as_state_machine.  To fix it, I removed
self.method(action).call from run_transition_action(action) method in
acts_as_state_machine.rb, and replaced it with self.send(action),
since self.method(action) was causing the SecurityError (Insecure:
can't modify array).

Here's two other links from people who have run into the same problem
in the past:

http://cmms.norfello.com/cmms/ticket/445
http://code.google.com/p/dry-scaffold/source/browse/dry_scaffold/CHANGELOG

This issue existed in revision 66 of the acts_as_state_machine from here:

http://elitists.textdriven.com/svn/plugins/acts_as_state_machine/trunk/lib/acts_as_state_machine.rb

I'm not sure if it still exists in the github version.


Mike

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to