routes

Rails 3, shallow routes

ぃ、小莉子 提交于 2019-12-03 12:50:31
In rails 2.x I used shallow routes, but this seems to be missing from rails 3 (at least in the API http://apidock.com/rails/ActionController/Resources/resources ). When I pass this option in rails 3 it doesn't throw any errors, but I'm also not getting all of the routes I expected. Rails 3 routes.rb resources :users, :shallow=>true do resources :recipe do resources :categories do resources :sections do resources :details do end end end end end The routes missing that were generated with the rails 2.x equivalent are (just a sample for the recipe resource): GET new_recipe (I only have new_user

Laravel say that Auth guard [] is not defined

家住魔仙堡 提交于 2019-12-03 11:34:22
问题 I'm beginer and I start learn and code with laravel... To enable user login nad registration I write this (as I see on one tutorilal) : at routes.php Route::controllers([ 'auth'=>'Auth\AuthController', 'password'=>'Auth\PasswordController', ]); and now when I type: http://localhost:8888/auth/login I get error: InvalidArgumentException in AuthManager.php line 71: Auth guard [] is not defined. Also in view folder there is no auth directory and login.blade.php files and other. 回答1: Make sure

Route localization in ASP.NET Core 2

…衆ロ難τιáo~ 提交于 2019-12-03 11:24:33
I am developing an online store using ASP.NET Core 2 and I am struggling with how to implement route localization, ex. depending from the country where user is from I want him to see /en/products or /pl/produkty. I managed to implement culture as part of the url, like /en/...., and user can also change default language by clicking a button on the website. However, I have no idea how to localize whole urls. I don't want to put hundreds of urls in Startup.cs (MapRoute). I need a better solution, which is working automatically behind the scenes. If someone change directly the url (ex. en/products

How do unit testing for IgnoreRoute in ASP.NET MVC

萝らか妹 提交于 2019-12-03 11:23:31
In ASP.NET MVC, I can get information on unit testing for routes and custom routes, but I can not figure out how to do unit testing for IgnoreRoute. routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); Practical code is much appreciated. ASP.NET MVC Framework (Part 2): URL Routing ASP.NET MVC Tip #13 – Unit Test Your Custom Routes ASP.NET MVC Tip #30 – Create Custom Route Constraints I would check that the RouteHandler on the RouteData for a route matching the ignored path is of type StopRoutingHandler; [TestMethod] public void TestIgnoredRoute() { // Arrange var routes = new RouteCollection();

How to map a route for /News/5 to my news controller

自古美人都是妖i 提交于 2019-12-03 10:55:29
I am trying to identify how to map a route for /News/5 to my news controller. This is my NewsController: public class NewsController : BaseController { // // GET: /News public ActionResult Index(int id) { return View(); } } This is my Global.asax.cs rule: routes.MapRoute( "News", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "News", action = "Index", id = -1 } // Parameter defaults ); I try to go to /News/5 but I receive a resource not found error, however when going to /News/Index/5 it works? I have tried just {controller}/{id} but that just produced

AngularJS - Best way to update $route parameter

时光毁灭记忆、已成空白 提交于 2019-12-03 10:44:53
I have several routes that are different, but contain similar parameters. Example: when '/user/:accountId/charts/:chartType', controller:ChartsController when '/manager/:accountId/charts/:chartType', controller:ChartsController when '/whatever/pathy/paththingy/charts/:chartType', controller:ChartsController Notice all three views use the same Charts Controller to control the view. Its a fairly generic controller but it needs toggle between available chartTypes... while keeping the rest of the route. Example: (THIS DOESN'T WORK) if my currrent url is '/user/001/charts/comparison' Then I call

How to use Rails named route helpers with parameters?

与世无争的帅哥 提交于 2019-12-03 10:40:53
问题 given this route match 'posts/hello/:name/:title' => 'post#show', :as => :hello what are the ways that I can call hello_path ? if i call hello_path(@post) , what does it try to do? I was hoping that the :name and :title files will bind to the path automatically but it seems that rails only know how to get the :id out of the model object. instead, it only works if I call it like <%= link_to "link2", hello_url(:name=> @post.name, :title=>@post.title) %> (lack of proper documentation is really

button_to with GET method option in Rails

≯℡__Kan透↙ 提交于 2019-12-03 10:06:55
I have the following button, which I overwrited to generate a GET request: = button_to "Tutor", {:controller => "appointments", :action => "new", :listing_id => @listing.id} , :method => :get However, I still get a POST request with extra params :method: Processing by AppointmentsController#new as HTML Parameters: {"authenticity_token"=>"AWkL", "listing_id"=>"2", "method"=>"get"} I my routes file, I have: resources :appointments What did I do wrong? Thank you. Buttons aren't supposed to be sending GET requests. You should use a link_to instead. If you want it to look like a button, apply some

in Android google maps api v2 for 4.0, show the routes from current location to given lat long

限于喜欢 提交于 2019-12-03 10:00:56
For android in google maps api v2 its showing whole earth by following all the steps from here http://mobisys.in/blog/2012/12/google-rolls-out-android-maps-api-v2/ , can i zoom in the route from current location to given lattitude and longitude, and the problem is i need to show multiple routes, how is it achievable?? right now i am not doing anything in my activity, but i think i have to do some coding for drawing the routes. how can i do this? thank you so much for your answers, and please provide me any tutorial if u know. thanks again. Finally i solved this problem by using this code.. :

What path is a mountable engine mounted on

别等时光非礼了梦想. 提交于 2019-12-03 09:41:04
问题 I need to know, from inside of a layout of a mountable engine, what path it's currently being mounted on. What would be the way to do it? E.g. my routes.rb contains the following line: mount BackendCore::Engine => "/backend" From inside of the BackendCore, I need the access to the value of "/backend". 回答1: If the engine is mouted :as => a different name, querying named_routes will not be sufficient. This monkey patch will do: class Rails::Engine def self.mounted_path route = Rails.application