rubyonrailsin

A Ruby and Rails talk

Saturday, March 13, 2010


[spree-user] Re: Upgrading spree

by rubyonrailsin 0 comments

Tag


Share this post:
Design Float
StumbleUpon
Reddit

Hi Guys,

I've been working on this all of today by breaking the upgrade down
step-by-step. It seems that tha actual problem lays within the routes
file.

As part of my seo strategy I have changed the nested_taxon in the
routes.rb file and removed the front '/t' as follows:
# route globbing for pretty nested taxon and product paths
map.nested_taxons '/*id', :controller => 'taxons', :action => 'show'

This seems to be causing some conflict with the new route that was
added in the lastest spree at the bottom of the routes file:
# a catchall route for "static" content
map.connect '*path', :controller => 'content', :action => 'show'

If I move the nested_taxons above the admin name space and map.connect
'*path' then the nested_taxons works fine on the front end, and the
admin pages don't display correctly. Whilst if I put the map.connect
'*path' closer to the top of the routes file then the admin section
displays correctly and the nested_taxons don't.

I'm really out of ideas on how to fix this so if any of the Spree core
team or anyone who can come up with a solution I would greatly
appreciate it.


Thanks,
Ryan

Here is the full routes file I have so far...

ActionController::Routing::Routes.draw do |map|

# Loads all extension routes in the order they are specified.
map.load_extension_routes

map.root :controller => "homepage", :action => "index"

map.resource :user_session, :member => {:nav_bar => :get}
map.resource :account, :controller => "users"
map.resources :password_resets

# login mappings should appear before all others
map.login '/login', :controller => 'user_sessions', :action => 'new'
map.logout '/logout', :controller => 'user_sessions', :action =>
'destroy'
map.signup '/signup', :controller => 'users', :action => 'new'
map.admin '/admin', :controller => 'admin/overview', :action =>
'index'

map.resources :tax_categories
map.resources :countries, :has_many => :states, :only => :index
map.resources :states, :only => :index
map.resources :users
map.resources :products, :member => {:change_image => :post}
map.resources :orders, :member => {:address_info => :get}, :has_many
=> [:line_items, :creditcards, :creditcard_payments]
map.resources :orders, :member => {:fatal_shipping => :get} do |
order|
order.resources :shipments, :member => {:shipping_method => :get}
order.resource :checkout, :member => {:register => :any}
end
#map.resources :shipments, :member => {:shipping_method => :any}

# Search routes
map.simple_search '/s/*product_group_query', :controller =>
'products', :action => 'index'
map.pg_search '/pg/:product_group_name', :controller =>
'products', :action => 'index'


# a catchall route for "static" content
map.connect '/web/*path', :controller => 'content', :action =>
'show'

map.taxons_search '/*id/s/*product_group_query', {
:controller => 'taxons',
:action => 'show'
}
map.taxons_pg_search '/*id/pg/:product_group_name', {
:controller => 'taxons',
:action => 'show'
}

map.resources :taxons

# route globbing for pretty nested taxon and product paths

map.nested_taxons '/*id', :controller => 'taxons', :action => 'show'

#map.connect '*path', :controller => 'content', :action => 'show'
map.namespace :admin do |admin|
admin.resources :coupons
admin.resources :zones
admin.resources :users
admin.resources :countries, :has_many => :states
admin.resources :states
admin.resources :tax_categories
admin.resources :configurations
admin.resources :products, :member => {:clone => :get}, :has_many
=> [:product_properties, :images] do |product|
product.resources :variants
product.resources :option_types, :member => { :select
=> :get, :remove => :get}, :collection => {:available
=> :get, :selected => :get}
product.resources :taxons, :member => {:select => :post, :remove
=> :post}, :collection => {:available => :post, :selected => :get}
end
admin.resources :option_types
admin.resources :properties, :collection => {:filtered => :get}
admin.resources :prototypes, :member => {:select
=> :post}, :collection => {:available => :get}
admin.resource :mail_settings
admin.resource :inventory_settings
admin.resources :google_analytics
admin.resources :orders, :has_many =>
[:adjustments, :line_items], :has_one => :checkout, :member => {:fire
=> :put, :resend => :post, :history => :get} do |order|
order.resources :shipments, :member => {:fire => :put}
order.resources :return_authorizations, :member => {:fire
=> :put}
end
admin.resources :orders do |order|
order.resources :payments, :member => {:fire => :put, :finalize
=> :put}
end
admin.resource :general_settings
admin.resources :taxonomies, :member => { :get_children => :get }
do |taxonomy|
taxonomy.resources :taxons
end
admin.resources :reports, :only => [:index, :show], :collection =>
{:sales_total => :get}

admin.resources :shipments
admin.resources :shipping_methods
admin.resources :shipping_categories
admin.resources :shipping_rates
admin.resources :tax_rates
admin.resource :tax_settings
admin.resources :calculators
admin.resources :product_groups, :has_many => :product_scopes
admin.resources :trackers
admin.resources :payment_methods
end

map.connect ':controller/:action/:id.:format'
map.connect ':controller/:action/:id'

# a catchall route for "static" content
map.connect '*path', :controller => 'content', :action => 'show'

end

--
You received this message because you are subscribed to the Google Groups "Spree" group.
To post to this group, send email to spree-user@googlegroups.com.
To unsubscribe from this group, send email to spree-user+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.

No comments:

Post a Comment

Subscribe feeds via e-mail

Blog Archive