Is it possible that the app gets confused with named paths which have the same
name (theoretically)?
If you switch the get and the post like this
namespace :search do
get "/" , :to => :index
get :test
post :test
get :results
post :results
end
then the GET gets the name:
search GET /search(.:format)
search#index
search_test GET /search/test(.:format)
search#test
POST /search/test(.:format)
search#test
search_results GET /search/results(.:format) search#results
POST /search/results(.:format)
search#results
You could try this
namespace :search do
get "/" , :to => :index
get :test
post :test
post :results, :as => 'post_results'
get :results
end
with
form_tag(search_post_results_path, :class => 'search') do
or just
form_tag({:controller => 'search', :action => 'results'}, :class =>
'search') do
Hope that helps,
Thorsten
On 8/08/2012, at 4:23 PM, Tim Uckun wrote:
> On Wed, Aug 8, 2012 at 4:01 PM, Thorsten Böttger <[email protected]> wrote:
>> Haven't had the problem yet. But what does
>>
>> rake routes | grep search
>>
>> say?
>>
>>
>
>
> search GET /search(.:format)
> search#index
> search_test GET /search/test(.:format)
> search#test
> POST /search/test(.:format)
> search#test
> search_results POST /search/results(.:format)
> search#results
> GET /search/results(.:format)
> search#results
>
>
>
>
>
>
>> On 8/08/2012, at 3:54 PM, Tim Uckun wrote:
>>
>>> Hey guys I ran into a very strange problem today and for the life of
>>> me I can't make heads or tails of it.
>>>
>>> My rails app will seemingly spontaneously start writing broken URLs
>>> into the links, forms etc. For example.
>>>
>>> I have the following route
>>>
>>> namespace :search do
>>> get "/" , :to => :index
>>> get :test
>>> post :test
>>> post :results
>>> get :results
>>> end
>>>
>>> The search form is defined like this
>>>
>>> form_tag(search_results_path, :class => 'search') do
>>>
>>>
>>> When the app launches this points to /search/results as expected but
>>> after a while if you reload the page the application points the page
>>> to / :search / :results
>>>
>>> If I touch restart.txt everything is fine again for a little while. It
>>> seems to effects different routes at random times. Some routes are OK
>>> and others are not. Then other routes go bad.
>>>
>>> I am running passenger so I am thinking maybe to passenger is
>>> reloading the app and somehow rails is getting confused. Has anybody
>>> ran into anything like this?
>>>
>>> Rails 3.2.7, REE, Ubuntu server.
>>>
>>> Cheers.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "WellRailed" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/wellrailed?hl=en.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "WellRailed" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/wellrailed?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "WellRailed" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/wellrailed?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"WellRailed" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/wellrailed?hl=en.