[Rails-core] RegexpError (regular expression too big)

2006-06-07 Thread Solomon White

Hello all--

I encountered an issue last night that appears to be related to the  
new routes implementation.  We're running edge rails for our  
production e-commerce app (* ignores snickers from the crowd *), and  
had to roll back when last night's deployment failed.  What we were  
seeing in the log is:



 
--

Processing Base#index (for 10.0.1.252 at 2006-06-05 23:22:56) [GET]
  Session ID: 051255ad8aed403a821bafba0950d079
  Parameters: {}


RegexpError (regular expression too big: /  *** large regexp fragment  
here ***):
/vendor/rails/actionpack/lib/action_controller/routing.rb:515:in  
`initialize'
/vendor/rails/actionpack/lib/action_controller/routing.rb:515:in  
`regexp_chunk'
/vendor/rails/actionpack/lib/action_controller/routing.rb:196:in  
`recognition_extraction'
/vendor/rails/actionpack/lib/action_controller/routing.rb:194:in  
`recognition_extraction'
/vendor/rails/actionpack/lib/action_controller/routing.rb:158:in  
`write_recognition'
/vendor/rails/actionpack/lib/action_controller/routing.rb:247:in  
`recognize'
/vendor/rails/actionpack/lib/action_controller/routing.rb:996:in  
`recognize_path'
/vendor/rails/actionpack/lib/action_controller/routing.rb:995:in  
`recognize_path'
/vendor/rails/actionpack/lib/action_controller/routing.rb:988:in  
`recognize'

*** stack trace continues ***
 
--



I can't seem to duplicate this anywhere -- running the below code in  
the console (taken from routing.rb:514-515 and tweaked for irb) runs  
fine.



 
--
possible_names =  
ActionController::Routing.possible_controllers.collect { |name|  
Regexp.escape name }

regexp = nil
Regexp.new("(?i-:(#{(regexp || Regexp.union 
(*possible_names)).source}))")
 
--


A bit of trivia here:  our possible_names array contains 125 entries,  
and the resulting regular expression source is ~ 3500 characters.


As a separate issue:  I did notice in perusing the possible_names  
array that there is now a lot of "stuff" which rails will recognize  
as an "available" route out of the box (for example:  /rails/ 
actionpack/examples/address_book), so it feels like $LOAD_PATH needs  
to be filtered a bit, at least for a production environment.  Is this  
expanded route scope by design, or should I file a ticket on it?


Back to the main issue, any ideas on reproducing/troubleshooting the  
Regexp exception?  We've configured a parallel deployment of the app  
and run it successfully on another port, but I'm not yet warm and  
fuzzy that the issue won't pop up again.


Thanks in advance,

Solomon
___
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core


[Rails-core] Routing code patch

2006-06-07 Thread Blair Zajac
I just opened a ticket for the new routing code that breaks the restful_rails 
plugin.  The plugin is using the public API for inserting routes and not going 
behind the scenes, besides adding a #connect_resource method to the routing code 
that adds multiple routes using #connect.


The code that is using the API can be seen by running

$ svn cat 
svn://rubyforge.org/var/svn/restful-rails/trunk/lib/rest_controller/routes.rb


The ticket and a patch is at

http://dev.rubyonrails.org/ticket/5314

Regards,
Blair

--
Blair Zajac, Ph.D.
<[EMAIL PROTECTED]>
Subversion training, consulting and support
http://www.orcaware.com/svn/
___
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core


[Rails-core] #5209 patch: :dependent => :nullify deletes child records

2006-06-07 Thread Chris Mear

Hi everyone,

A couple of weeks ago I noticed a bug with :dependent => :nullify on  
a has_many or has_one. When you delete the parent, the children's  
foreign keys are nullified, as expected. But when you do  
parent.child.delete or parent.children.clear, ActiveRecord actually  
deletes the child records, rather than just nullifying them.


In my eyes, if you've set :dependent => :nullify, you're saying that  
the child records should only ever be nullified, not deleted. The  
behaviour I'm seeing seems to be a hang over from when  
setting :dependent always meant 'delete/destroy the children'.


However, I realise that maybe this is just my interpretation of what  
the :dependent => :nullify option is supposed to do. So I'd be  
interested to hear what everyone else thinks.


I've written up the problem, with a patch, here:

http://dev.rubyonrails.org/ticket/5209

Cheers,
Chris

___
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core


Re: [Rails-core] RegexpError (regular expression too big)

2006-06-07 Thread Jamis Buck

Solomon,

I'll definitely take a look at it today and see what I can find. In  
the meantime, please note that the current routes impl is NOT ready  
for production. It is known to be inefficient in several areas  
(particularly route generation) and buggy (as you discovered). We are  
working hard to eliminate the bugs, and are getting closer, but it is  
still experimental.


- Jamis

On Jun 6, 2006, at 10:49 AM, Solomon White wrote:


Hello all--

I encountered an issue last night that appears to be related to the  
new routes implementation.  We're running edge rails for our  
production e-commerce app (* ignores snickers from the crowd *),  
and had to roll back when last night's deployment failed.  What we  
were seeing in the log is:



-- 


Processing Base#index (for 10.0.1.252 at 2006-06-05 23:22:56) [GET]
  Session ID: 051255ad8aed403a821bafba0950d079
  Parameters: {}


RegexpError (regular expression too big: /  *** large regexp  
fragment here ***):
/vendor/rails/actionpack/lib/action_controller/routing.rb: 
515:in `initialize'
/vendor/rails/actionpack/lib/action_controller/routing.rb: 
515:in `regexp_chunk'
/vendor/rails/actionpack/lib/action_controller/routing.rb: 
196:in `recognition_extraction'
/vendor/rails/actionpack/lib/action_controller/routing.rb: 
194:in `recognition_extraction'
/vendor/rails/actionpack/lib/action_controller/routing.rb: 
158:in `write_recognition'
/vendor/rails/actionpack/lib/action_controller/routing.rb: 
247:in `recognize'
/vendor/rails/actionpack/lib/action_controller/routing.rb: 
996:in `recognize_path'
/vendor/rails/actionpack/lib/action_controller/routing.rb: 
995:in `recognize_path'
/vendor/rails/actionpack/lib/action_controller/routing.rb: 
988:in `recognize'

*** stack trace continues ***
-- 




I can't seem to duplicate this anywhere -- running the below code  
in the console (taken from routing.rb:514-515 and tweaked for irb)  
runs fine.



-- 

possible_names =  
ActionController::Routing.possible_controllers.collect { |name|  
Regexp.escape name }

regexp = nil
Regexp.new("(?i-:(#{(regexp || Regexp.union 
(*possible_names)).source}))")
-- 



A bit of trivia here:  our possible_names array contains 125  
entries, and the resulting regular expression source is ~ 3500  
characters.


As a separate issue:  I did notice in perusing the possible_names  
array that there is now a lot of "stuff" which rails will recognize  
as an "available" route out of the box (for example:  /rails/ 
actionpack/examples/address_book), so it feels like $LOAD_PATH  
needs to be filtered a bit, at least for a production environment.   
Is this expanded route scope by design, or should I file a ticket  
on it?


Back to the main issue, any ideas on reproducing/troubleshooting  
the Regexp exception?  We've configured a parallel deployment of  
the app and run it successfully on another port, but I'm not yet  
warm and fuzzy that the issue won't pop up again.


Thanks in advance,

Solomon
___
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core


___
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core


[Rails-core] Feedback needed on scoping

2006-06-07 Thread Julian 'Julik' Tarkhanov
I already asked nzkoz about this, but I have some questions  
unanswered on

http://dev.rubyonrails.org/ticket/5305

Would someone take a look?
--
Julian 'Julik' Tarkhanov
please send all personal mail to
me at julik.nl


___
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core


Re: [Rails-core] RegexpError (regular expression too big)

2006-06-07 Thread Jamis Buck

Solomon,

Can you svn up and see if it works now? I've made the  
possible_controllers code smarter, so it should return a much smaller  
list of possible controllers. Definitely still room for improvement,  
but it's better than it was.


- Jamis

On Jun 7, 2006, at 7:52 AM, Jamis Buck wrote:


Solomon,

I'll definitely take a look at it today and see what I can find. In  
the meantime, please note that the current routes impl is NOT ready  
for production. It is known to be inefficient in several areas  
(particularly route generation) and buggy (as you discovered). We  
are working hard to eliminate the bugs, and are getting closer, but  
it is still experimental.


- Jamis

On Jun 6, 2006, at 10:49 AM, Solomon White wrote:


Hello all--

I encountered an issue last night that appears to be related to  
the new routes implementation.  We're running edge rails for our  
production e-commerce app (* ignores snickers from the crowd *),  
and had to roll back when last night's deployment failed.  What we  
were seeing in the log is:



- 
-

Processing Base#index (for 10.0.1.252 at 2006-06-05 23:22:56) [GET]
  Session ID: 051255ad8aed403a821bafba0950d079
  Parameters: {}


RegexpError (regular expression too big: /  *** large regexp  
fragment here ***):
/vendor/rails/actionpack/lib/action_controller/routing.rb: 
515:in `initialize'
/vendor/rails/actionpack/lib/action_controller/routing.rb: 
515:in `regexp_chunk'
/vendor/rails/actionpack/lib/action_controller/routing.rb: 
196:in `recognition_extraction'
/vendor/rails/actionpack/lib/action_controller/routing.rb: 
194:in `recognition_extraction'
/vendor/rails/actionpack/lib/action_controller/routing.rb: 
158:in `write_recognition'
/vendor/rails/actionpack/lib/action_controller/routing.rb: 
247:in `recognize'
/vendor/rails/actionpack/lib/action_controller/routing.rb: 
996:in `recognize_path'
/vendor/rails/actionpack/lib/action_controller/routing.rb: 
995:in `recognize_path'
/vendor/rails/actionpack/lib/action_controller/routing.rb: 
988:in `recognize'

*** stack trace continues ***
- 
-



I can't seem to duplicate this anywhere -- running the below code  
in the console (taken from routing.rb:514-515 and tweaked for irb)  
runs fine.



- 
-
possible_names =  
ActionController::Routing.possible_controllers.collect { |name|  
Regexp.escape name }

regexp = nil
Regexp.new("(?i-:(#{(regexp || Regexp.union 
(*possible_names)).source}))")
- 
-


A bit of trivia here:  our possible_names array contains 125  
entries, and the resulting regular expression source is ~ 3500  
characters.


As a separate issue:  I did notice in perusing the possible_names  
array that there is now a lot of "stuff" which rails will  
recognize as an "available" route out of the box (for example:  / 
rails/actionpack/examples/address_book), so it feels like  
$LOAD_PATH needs to be filtered a bit, at least for a production  
environment.  Is this expanded route scope by design, or should I  
file a ticket on it?


Back to the main issue, any ideas on reproducing/troubleshooting  
the Regexp exception?  We've configured a parallel deployment of  
the app and run it successfully on another port, but I'm not yet  
warm and fuzzy that the issue won't pop up again.


Thanks in advance,

Solomon
___
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core


___
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core


___
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core


Re: [Rails-core] Routing code patch

2006-06-07 Thread Jamis Buck

Blair, thanks for this patch. It's been applied.

- Jamis

On Jun 6, 2006, at 5:36 PM, Blair Zajac wrote:

I just opened a ticket for the new routing code that breaks the  
restful_rails plugin.  The plugin is using the public API for  
inserting routes and not going behind the scenes, besides adding a  
#connect_resource method to the routing code that adds multiple  
routes using #connect.


The code that is using the API can be seen by running

$ svn cat svn://rubyforge.org/var/svn/restful-rails/trunk/lib/ 
rest_controller/routes.rb


The ticket and a patch is at

http://dev.rubyonrails.org/ticket/5314

Regards,
Blair

--
Blair Zajac, Ph.D.
<[EMAIL PROTECTED]>
Subversion training, consulting and support
http://www.orcaware.com/svn/
___
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core


___
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core


Re: [Rails-core] Routing code patch

2006-06-07 Thread Blair Zajac

Jamis,

Thanks!

Blair

Jamis Buck wrote:

Blair, thanks for this patch. It's been applied.

- Jamis

On Jun 6, 2006, at 5:36 PM, Blair Zajac wrote:

I just opened a ticket for the new routing code that breaks the  
restful_rails plugin.  The plugin is using the public API for  
inserting routes and not going behind the scenes, besides adding a  
#connect_resource method to the routing code that adds multiple  
routes using #connect.


The code that is using the API can be seen by running

$ svn cat svn://rubyforge.org/var/svn/restful-rails/trunk/lib/ 
rest_controller/routes.rb


The ticket and a patch is at

http://dev.rubyonrails.org/ticket/5314

Regards,
Blair


___
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core


Re: [Rails-core] Too. Many. Scriptaculous. Tickets.

2006-06-07 Thread Giles Bowkett

Right, it isn't getting rid of magic lantern patches so much as magic
lantern requests without a patch.


OK this just makes me think in terms of economics.

Requests for enhancements which require no action on the requestor's
part are guaranteed to trigger "tragedy of the commons" effects. That
is, if people can get things for free, the resource will be wasted,
irrespective of how useful it is.

If people have the ability to request enhancements without first being
required to go to some effort, it is highly likely that sooner or
later they will request enhancements that already exist. The effort is
nil, the resource is free, and there might be a payoff. Basically,
this is the reason spam exists.

+1 on getting rid of magic lantern requests without patches.

--
Giles Bowkett
http://www.gilesgoatboy.org
___
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core


[Rails-core] Reloadable modules

2006-06-07 Thread Blair Zajac
There's a scenario with the projects I'm working on that could use reloadable 
modules, instead of just reloadable classes.


Ticket and patch with test suite changes are at:

http://dev.rubyonrails.org/ticket/5329

The reasoning for doing this is I have a library of 25 and growing plugins that 
define AR models for an legacy Oracle system with some 300 tables.  The plan is 
that developers in our group can use the plugins for their apps and do something 
like


class Post < ActiveRecord::Base
  include Plugin::PostModel

  def my_application_specific_method
  end
end

There are tons of apps, all separate, so sharing AR models via plugins is nice.

So Post is reloaded in development mode, but if you're writing 
Plugin::PostModel, then it's not reloaded and you have to restart the server. 
The patch let's you do


module Plugin
  module PostModel
include Reloadable
  end
end

and have these reloaded also.

Regards,
Blair

___
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core


Re: [Rails-core] Reloadable modules

2006-06-07 Thread Julian 'Julik' Tarkhanov


On 8-jun-2006, at 1:31, Blair Zajac wrote:

There's a scenario with the projects I'm working on that could use  
reloadable modules, instead of just reloadable classes.


Ticket and patch with test suite changes are at:

http://dev.rubyonrails.org/ticket/5329


I am now building an app that assembles functionality from modules  
and this is instrumental - I'm sick of restarting the server. Would  
love to see it in Rails.


--
Julian 'Julik' Tarkhanov
please send all personal mail to
me at julik.nl


___
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core


Re: [Rails-core] Reloadable modules

2006-06-07 Thread Trevor Squires

Hey,

I too have felt the pain of having to restart the server when working  
on the modules in plugins.


However it's easily avoided by putting a require_dependency  
'my_module' just before the include MyModule call.  It's a small  
amount of pain that I only have to bear during development so it's  
okay with me.


I'm not saying this patch is without merit - just that you can work  
around the issue without having to tinker with the way that rails  
loads stuff now.


Regards,
Trevor
--
Trevor Squires
http://somethinglearned.com

On 7-Jun-06, at 8:14 PM, Julian 'Julik' Tarkhanov wrote:



On 8-jun-2006, at 1:31, Blair Zajac wrote:

There's a scenario with the projects I'm working on that could use  
reloadable modules, instead of just reloadable classes.


Ticket and patch with test suite changes are at:

http://dev.rubyonrails.org/ticket/5329


I am now building an app that assembles functionality from modules  
and this is instrumental - I'm sick of restarting the server. Would  
love to see it in Rails.


--
Julian 'Julik' Tarkhanov
please send all personal mail to
me at julik.nl


___
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core


___
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core


Re: [Rails-core] Reloadable modules

2006-06-07 Thread Julian 'Julik' Tarkhanov


On 8-jun-2006, at 6:01, Trevor Squires wrote:


However it's easily avoided by putting a require_dependency  
'my_module' just before the include MyModule call.  It's a small  
amount of pain that I only have to bear during development so it's  
okay with me.


Thanks for the tip Trevor!

--
Julian 'Julik' Tarkhanov
please send all personal mail to
me at julik.nl


___
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core