routes

Route to multiple sub folders in CodeIgniter

馋奶兔 提交于 2019-11-30 03:55:40
问题 I have a admin folder set up in my controllers directory, under that i have 3 seperate sub-folders with controllers inside of them. -- Controllers ---- Admin ------ Dashboard -------- dashboard.php -------- file.php ------ Members -------- members.php -------- file.php ------ Settings -------- settings.php -------- file.php I tried routing it in the routes.php file like this $route['admin/(:any)/(:any)'] = 'admin/$1/$2'; $route['admin/(:any)'] = 'admin/$1/$1'; $route['admin'] = 'admin/index';

Rails: how to use scope with params and use route with default value of params

社会主义新天地 提交于 2019-11-30 03:53:02
I have such lines in routes.rb: scope "/:subdomain/" do resource :order, :only => [:new, :create, :show, :update, :edit, :destroy] do get :cancel, :on => :member put :counter, :on => :member end end And for example, this is typical url: http://mydomain.com/some_subdomain/order/new . This url is mapped to action new of orders controller with params[:subdomain] = "some_subdomain". I want to use named route new_order_url(:subdomain => "some_subdomain"). But I want to map http://mydomain.com/order/new to orders controller, action new and params[:subdomain] = "default". And I want to use named

Camel Exception handling doesnt work if exception clause is defined in a separate class

丶灬走出姿态 提交于 2019-11-30 03:30:57
问题 I am trying to build a application with several camel routes which re use many common routes internally. Hence, I am trying to segregate the routes in several different Route Builder classes and then connecting the routes where needed. For eg, all routes pertaining to sending emails go into a EmailRouteBuilder class and all routes dealing with a particular JMS Queue go into MyQueueRouteBuilder class. I suppose this should be alright since Camel doesnt not distinguish between classes and only

Rails Restful Routing and Subdomains

﹥>﹥吖頭↗ 提交于 2019-11-30 03:28:28
I wondered if there were any plugins or methods which allow me to convert resource routes which allow me to place the controller name as a subdomain. Examples: map.resources :users map.resource :account map.resources :blog ... example.com/users/mark example.com/account example.com/blog/subject example.com/blog/subject/edit ... #becomes users.example.com/mark account.example.com blog.example.com/subject blog.example.com/subject/edit ... I realise I can do this with named routes but wondered if there were some way to keep my currently succinct routes.rb file. The best way to do it is to write a

how do return the $state.current.name from ui-router statechange

风流意气都作罢 提交于 2019-11-30 03:14:08
I would like to return the .state('name') when I change location in angular. From my run() it can return the $state object: .run(function($rootScope, Analytics, $location, $stateParams, $state) { console.log($state); but when I try to get $state.current it is empty object .run(function($rootScope, $location, $stateParams, $state) { console.log($state.current); config example: .config(function($stateProvider, $urlRouterProvider, AnalyticsProvider) { $urlRouterProvider.otherwise('/'); $stateProvider .state('home', { url: '/', views: { '': { templateUrl: 'views/main.html', controller: 'MainCtrl'

Getting Rails URL helpers to automatically output https urls

橙三吉。 提交于 2019-11-30 02:50:00
I am developing a site that mixes http and https a lot - whats the best/easiest way to make the links use the right protocol for the route - can it be specified in the routes file? Say I have the following route in Rails 3. match "/test" => "test#index", :as => :test, :constraints => { :protocol => 'https' } If I'm on a http page, and I use test_url() , it'll output http://domain.com/test . I want https://domain.com/test instead. I know I can use test_url(:secure => true) , but that's duplicating logic. I know I could have http://domain.com/test to https://domain.com/test , but that's an extra

Laravel: How to Route to Public file

偶尔善良 提交于 2019-11-30 02:16:26
问题 In Laravel, is it possible to redirect to a public/testFile.php , through routing? In the application/routes.php , Route::get('/', function() { //'How to point to public/testFile.php' }); Have an existing Project, But want to do Only the NEW MODULES in Laravel. So copied the Existing project under Public/ 回答1: You are completely defeating the purpose of the framework by doing this, but if you really want to... Route::get("/", function() { ob_start(); require(path("public")."testFile.php");

Android How to show route between markers on googlemaps

蓝咒 提交于 2019-11-30 02:13:36
I'm creating an App that will show the location of the user and put a marker to that position. After the user moves. The marker would be removed and a new marker would be created. Now. I want to make markers on Point A and Point B to be hardcoded into the app and show the route on the map. It shall use the nearest road on the map. I've done some research but only find old code which dated 5 years back. Could anyone be kind enough to guide me through this. The Point A and Point B is on LocationChanged method. import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms

Finding the number of paths of given length in a undirected unweighted graph

冷暖自知 提交于 2019-11-30 02:07:07
'Length' of a path is the number of edges in the path. Given a source and a destination vertex, I want to find the number of paths form the source vertex to the destination vertex of given length k. We can visit each vertex as many times as we want, so if a path from a to b goes like this: a -> c -> b -> c -> b it is considered valid. This means there can be cycles and we can go through the destination more than once. Two vertices can be connected by more than one edge. So if vertex a an vertex b are connected by two edges, then the paths , a -> b via edge 1 and a -> b via edge 2 are

How to write controller tests when you override devise registration controller?

雨燕双飞 提交于 2019-11-30 01:55:57
I wish to override the Devise::RegistrationsController to implement some custom functionalality. To do this, I've created a new RegistrationsController like so: # /app/controllers/registrations_controller.rb class RegistrationsController < Devise::RegistrationsController def new super end end and set up my routes like this: devise_for :users, :controllers => { :registrations => "registrations" } and tried to test it like this: describe RegistrationsController do describe "GET 'new'" do it "should be successful" do get :new response.should be_success end end end but that gives me an error: 1)