inconsistent routing

View: New views
14 Messages — Rating Filter:   Alert me  

inconsistent routing

by Benny Degezelle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi list,

I'm getting some weird routing issues.
My extension defines two routes to send requests to a new controller.
It looks like these routes are only recognized about half of the time
(at random).
The other times the url is just sent to the site_controller for 'normal'
processing.

I guess this means that my laptop is too slow half of the time, and that
the extra routes are not set fast enough..?

It doesn't seem to matter if i move the extension to the front or the
end of the extension load_order.

Anybody have a clue of what could cause or even better fix this?


Thanks in advance,

Benny
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Radiant mailing list
Post:   Radiant@...
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Re: inconsistent routing

by Sean Cribbs-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Benny,

Would you paste us the route definitions?

Sean

Benny Degezelle wrote:

> Hi list,
>
> I'm getting some weird routing issues.
> My extension defines two routes to send requests to a new controller.
> It looks like these routes are only recognized about half of the time
> (at random).
> The other times the url is just sent to the site_controller for 'normal'
> processing.
>
> I guess this means that my laptop is too slow half of the time, and that
> the extra routes are not set fast enough..?
>
> It doesn't seem to matter if i move the extension to the front or the
> end of the extension load_order.
>
> Anybody have a clue of what could cause or even better fix this?
>
>
> Thanks in advance,
>
> Benny
>  

_______________________________________________
Radiant mailing list
Post:   Radiant@...
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Re: inconsistent routing

by Benny Degezelle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

;
  define_routes do |map|
    map.connect "en/shop/:action/:id", :controller => 'shop', :language
=> 'en-US'
    map.connect "nl/shop/:action/:id", :controller => 'shop', :language
=> 'nl-BE'
  end

Sean Cribbs wrote:
> Benny,
>
> Would you paste us the route definitions?
>
> Sean

--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Radiant mailing list
Post:   Radiant@...
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Re: inconsistent routing

by Sean Cribbs-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Benny,

Try this:

define_routes do |map|
    map.with_options :controller => 'shop', :action => 'index' do |shop|
      shop.connect "en/shop/:action/:id", :language => 'en-US'
      shop.connect "nl/shop/:action/:id", :language => 'nl-BE'
    end
end

My guess is that without the "default" action of 'index', it doesn't
match.  You can test these in a functional test:

def test_shop_routing_with_language
  assert_recognizes "/en/shop", :controller => "shop", :action =>
"index", :language => 'en-US'
  assert_recognizes "/nl/shop", :controller => "shop", :action =>
"index", :language => 'nl-BE'
  # etc...
end

Sean

Benny Degezelle wrote:

> ;
>   define_routes do |map|
>     map.connect "en/shop/:action/:id", :controller => 'shop', :language
> => 'en-US'
>     map.connect "nl/shop/:action/:id", :controller => 'shop', :language
> => 'nl-BE'
>   end
>
> Sean Cribbs wrote:
>  
>> Benny,
>>
>> Would you paste us the route definitions?
>>
>> Sean
>>    
>
>  

_______________________________________________
Radiant mailing list
Post:   Radiant@...
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Re: inconsistent routing

by Benny Degezelle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Nope, i'm still getting the same results; sometimes works, sometimes
doesn't.

the assert_recognizes didn't seem to work that way, i had to switch the
first part ('/en/shop') and the options to get those to pass

Sean Cribbs wrote:

> Benny,
>
> Try this:
>
> define_routes do |map|
>     map.with_options :controller => 'shop', :action => 'index' do |shop|
>       shop.connect "en/shop/:action/:id", :language => 'en-US'
>       shop.connect "nl/shop/:action/:id", :language => 'nl-BE'
>     end
> end
>
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Radiant mailing list
Post:   Radiant@...
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Re: inconsistent routing

by Daniel Sheppard-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> I'm getting some weird routing issues.
> My extension defines two routes to send requests to a new controller.
> It looks like these routes are only recognized about half of the time
> (at random).
> The other times the url is just sent to the site_controller
> for 'normal'
> processing.

Do you have multiple mongrel/fcgi processes? Is it possible that you haven't restarted both of them? (and hence one may not have
read your code).

_______________________________________________
Radiant mailing list
Post:   Radiant@...
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Re: inconsistent routing

by Sean Cribbs-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Benny,

Ah, sorry.  You might try assert_routing, which does both a generation
and a recognition assertion.  Now, I don't know if it has anything to do
with your problem, but I have found that it's more reliable to use named
or resource routes in extensions.  I'm not sure if this is a Radiant
issue or a Rails issue.  Try naming those and see if it becomes more
consistent.

Sean

Benny Degezelle wrote:

> Nope, i'm still getting the same results; sometimes works, sometimes
> doesn't.
>
> the assert_recognizes didn't seem to work that way, i had to switch the
> first part ('/en/shop') and the options to get those to pass
>
> Sean Cribbs wrote:
>  
>> Benny,
>>
>> Try this:
>>
>> define_routes do |map|
>>     map.with_options :controller => 'shop', :action => 'index' do |shop|
>>       shop.connect "en/shop/:action/:id", :language => 'en-US'
>>       shop.connect "nl/shop/:action/:id", :language => 'nl-BE'
>>     end
>> end
>>
>>    

_______________________________________________
Radiant mailing list
Post:   Radiant@...
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Re: inconsistent routing

by Benny Degezelle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

assert_routing works indeed. The test passes, but i'm still getting the
same results:

>> app.get('/en/shop')
=> 302
>> app.get('/en/shop')
=> 200
>> app.get('/en/shop')
=> 302
>> app.get('/en/shop')
=> 200
>> app.get('/en/shop')
=> 302
>> app.get('/en/shop')
=> 200
>> app.get('/en/shop')
=> 200
>> app.get('/en/shop')
=> 200

This is with a named route.

Daniel; as far as i know i'm not working with multiple mongrel
processes. I'm still working in development mode only, and i haven't
played with setting up mongrel clusters or anything..
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Radiant mailing list
Post:   Radiant@...
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Re: inconsistent routing

by Sean Cribbs-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Are you using trunk or a previous version?  This bug may have been
introduced in the extension-loading refactoring.

Sean

Benny Degezelle wrote:

> assert_routing works indeed. The test passes, but i'm still getting the
> same results:
>
>  
>>> app.get('/en/shop')
>>>      
> => 302
>  
>>> app.get('/en/shop')
>>>      
> => 200
>  
>>> app.get('/en/shop')
>>>      
> => 302
>  
>>> app.get('/en/shop')
>>>      
> => 200
>  
>>> app.get('/en/shop')
>>>      
> => 302
>  
>>> app.get('/en/shop')
>>>      
> => 200
>  
>>> app.get('/en/shop')
>>>      
> => 200
>  
>>> app.get('/en/shop')
>>>      
> => 200
>
> This is with a named route.
>
> Daniel; as far as i know i'm not working with multiple mongrel
> processes. I'm still working in development mode only, and i haven't
> played with setting up mongrel clusters or anything..
>  

_______________________________________________
Radiant mailing list
Post:   Radiant@...
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Re: inconsistent routing

by Benny Degezelle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sean Cribbs wrote:
> Are you using trunk or a previous version?  This bug may have been
> introduced in the extension-loading refactoring.
>
> Sean

I'm on 0.6.4, running from gem
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Radiant mailing list
Post:   Radiant@...
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Re: inconsistent routing

by Sean Cribbs-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ah.  Try freezing to revision 679:

rake radiant:freeze:edge REVISION=679

Sean

Benny Degezelle wrote:

> Sean Cribbs wrote:
>  
>> Are you using trunk or a previous version?  This bug may have been
>> introduced in the extension-loading refactoring.
>>
>> Sean
>>    
>
> I'm on 0.6.4, running from gem
>  

_______________________________________________
Radiant mailing list
Post:   Radiant@...
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Wierd issue with production vs. development

by Christopher Dwan-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey all,

I'm building a rake task to pull all my data from my production db  
(MySql) to my development db (SQLite). It works great pulling in that  
direction, but when I go to reverse the process, it fails. It has to  
do with my plugin that uses attachment_fu.

Basically, I have a model Asset that uses 'has_attachment'. This is  
the code that doesn't work:

"asset".classify.constantize

This is the error:
NoMethodError: undefined method `has_attachment' for Asset:Class

Any ideas what the difference is between production and development  
that would cause this to not work?  I can run the server in dev mode,  
I just can't run constantize. This error does _not_ happen in the  
production environment.  I've tried changing the contents of config/
environments/development.rb with no success.

Thanks!

-Chris


_______________________________________________
Radiant mailing list
Post:   Radiant@...
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Re: inconsistent routing

by Benny Degezelle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sean Cribbs wrote:
> Ah.  Try freezing to revision 679:
>
> rake radiant:freeze:edge REVISION=679
>
> Sean

freezing didn't solve the problem, but i've found out more about it..
Turning off another extension, i noticed that i had good results more
often.
I then tried the extension on the production server, and it all works
flawless there..
maybe it's time for a reboot.. :)
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Radiant mailing list
Post:   Radiant@...
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Parent Message unknown Re: Wierd issue with production vs. development

by Christopher Dwan-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Nevermind, I must have had something wacky in my config. I started  
fresh with a new 0.6.4 install and brought in my extension, and it  
seems fine now. Sorry for the noise on the channel...

-C

>
> On 21-Feb-08, at 3:27 PM, Christopher Dwan wrote:
>
>> Hey all,
>>
>> I'm building a rake task to pull all my data from my production db  
>> (MySql) to my development db (SQLite). It works great pulling in  
>> that direction, but when I go to reverse the process, it fails. It  
>> has to do with my plugin that uses attachment_fu.
>>
>> Basically, I have a model Asset that uses 'has_attachment'. This is  
>> the code that doesn't work:
>>
>> "asset".classify.constantize
>>
>> This is the error:
>> NoMethodError: undefined method `has_attachment' for Asset:Class
>>
>> Any ideas what the difference is between production and development  
>> that would cause this to not work?  I can run the server in dev  
>> mode, I just can't run constantize. This error does _not_ happen in  
>> the production environment.  I've tried changing the contents of  
>> config/environments/development.rb with no success.
>>
>> Thanks!
>>
>> -Chris
>>
>>
>

_______________________________________________
Radiant mailing list
Post:   Radiant@...
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant