Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

localization - What's the proper way to handle localized name-spaced routes in Rails 2.3.8? -


i'm localizing application , struggling how handle routes specific portion of app.

initially had routes looked this:

     map.namespace :admin |admin|       admin.resources :people, :member => {:confirm_destroy => :get}, :collection => {:follow => :post, :sync_friends => :get, :upload => :post, :import => :get, :recommendations => :get, :mark_recommendations => :post, :batch_create => :post}       admin.resources :jobs, :collection => {:remove => :post}       admin.resources :users, :member => {:confirm_destroy => :get}       admin.resources :sites, :member => {:update_design => :post, :design => :get, :update_links => :post, :links => :get, :content => :get, :update_content => :post, :add_admin => :post, :remove_admin => :post, :set_system_account => :get, :confirm_system_account => :get}, :collection => {:remove => :post, :upload => :post}       admin.resources :subscriptions, :member => { :charge => :post, :migrate_plan => :post, :update_components => :post }       admin.resources :accounts, :collection => {:remove => :post}       admin.resources :subscription_plans, :as => 'plans'       admin.resources :subscription_discounts, :as => 'discounts'       admin.resources :twitter_lists, :collection => {:auto_generate_twitter_list => :post}     end 

from i've done on other routes need add: :path_prefix => '/:locale/' these routes.

the example i've come across looks this:

   map.with_options(:path_prefix => '/:locale/admin') |locale|     locale.namespace :admin |admin|       admin.resources :people, :member => {:confirm_destroy => :get}, :collection => {:follow => :post, :sync_friends => :get, :upload => :post, :import => :get, :recommendations => :get, :mark_recommendations => :post, :batch_create => :post}       admin.resources :subscriptions, :member => { :charge => :post, :migrate_plan => :post, :update_components => :post }       admin.resources :accounts, :collection => {:remove => :post}       etc etc etc     end   end 

this appears works great routes, however, screwing of generated urls.

for example had = link_to(t('subscription'), edit_admin_subscription_path(subscription_id) worked perfectly... after above change url no longer generates, giving following error:

 actioncontroller::routingerror in admin/base#index  showing app/views/admin/shared/_menu.html.haml line #13 raised:  edit_admin_subscription_url failed generate {:action=>"edit", :controller=>"admin/subscriptions", :locale=>bson::objectid('4d0ecb6587adddc91c000014')}, expected: {:controller=>"admin/subscriptions", :action=>"edit"}, diff: {:locale=>bson::objectid('4d0ecb6587adddc91c000014')} 

i sincerely appreciate insight can shed on proper way handle type of thing and/or why url doesn't generate longer. thanks!

so turns out after addition of localization, needed more specific the parameters passed url helper:

= link_to(t('subscription'), edit_admin_subscription_path(:id => subscription_id) works fine.

still not sure not if the

   map.with_options(:path_prefix => '/:locale/admin') |locale|     locale.namespace :admin |admin|

is best way that, @ least it's working now.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -