routes

An API version is required, but was not specified. webapi

我的未来我决定 提交于 2019-12-07 07:28:24
var constraintResolver = new DefaultInlineConstraintResolver() { ConstraintMap = { ["apiVersion"] = typeof( ApiVersionRouteConstraint ) } }; config.MapHttpAttributeRoutes(constraintResolver); config.AddApiVersioning(o => o.AssumeDefaultVersionWhenUnspecified = true); [ApiVersion("2.05")] [RoutePrefix("api/v{version:apiVersion}/ger")] public class caGerController [Route("~/api/ger/getDetail")] [Route("getDetail")] GetGerData [ApiVersion("1")] [RoutePrefix("api/v{version:apiVersion}/gerDetail")] public class caGerDetailsController caGerController [Route("~/api/gerDetail/getDetail")] [Route(

How do you pass multiple arguments to nested route paths in Rails?

淺唱寂寞╮ 提交于 2019-12-07 06:09:19
问题 I am new to Rails and normally set up a link_to helper for a normal unnested route like so: link_to "Delete", article_path(article.id), method: :delete, data: {confirm: "Are you sure?"} However I am learning about nested routes and it seems I need to provide the path with two arguments for example: link_to "(Delete)", article_comments_path(comment.article_id, comment.id), method: :delete, data:{comfirm: 'Are you sure?'} However this does not seem to work. I have seen that you can format the

Rails namespaced routes work in development but not production

ε祈祈猫儿з 提交于 2019-12-07 05:26:36
问题 I'm trying to nest some routes under the namespace, account. I want user management under account like /account/users and /account/users/5/edit In routes.rb: namespace :account do resources :users do member do put 'generate_api_key' end collection do post 'api_key' end end end My controllers are not namespaced or put them in any different directory. /app /controllers accounts_controller.rb users_controller.rb In my development environment this is working fine, but in production I get 404

ASP.NET MVC - Where do you put your .js files if you dont want to store them in /Scripts?

天大地大妈咪最大 提交于 2019-12-07 05:22:00
问题 I have a number of .js files that I would like to be stored in the same directories as their views (they're specific to a view - its simply to keep the javascript separate from the view's HTML) However, adding them to the /Views/ControllerName/ directory wont work because when a request is made to the webserver for the .js file: <script type="text/javascript" src="/Views/ControllerName/myscript.js"></script> It would essentially be directed at the 'Views' controller which obviously doesnt

Task async controller method does not hit

▼魔方 西西 提交于 2019-12-07 04:21:27
问题 So, we've got an MVC project that has been upgraded through the different versions of MVC from 1 through to 4. Now we have a controller method: public async Task<ActionResult> IndexAsync() so if we go to http://somedomain.xyz/WhicheverController or http://somedomain.xyz/WhicheverController/Index , we are greeted with a 404. http://somedomain.xyz/WhicheverController/IndexAsync routes to the method just fine. What's gone wrong with our routing? 回答1: I believe that your example will work if you

Build routes on top of a common base route?

我与影子孤独终老i 提交于 2019-12-07 03:07:41
问题 I have a common base path; say: get /base where I need to have basic auth performed and working for all sub calls under that path. Say: get /base/foo and get /base/bar . Looking at http://www.sinatrarb.com/intro.html#Helpers suggests I should be able to do this with the use of helpers. I was looking at the pass helper and use of call under triggering a new route in the documentation. But, another suggestion I read was using dynamic routing using regexes IE %r{/base/?:(path)?} or some such. So

Rails routes: Nested, Member, Collection, namespace, scope and customizable

你。 提交于 2019-12-07 02:56:50
问题 I am trying to understand more about Rails routes. Member and Collection # Example resource route with options: resources :products do member do get 'short' post 'toggle' end collection do get 'sold' end end Namespace and Scope # Example resource route within a namespace: namespace :admin do resources :products end scope :admin do resources :products end Constraints, Redirect_to # Example resource route with options: get "/questions", to: redirect {|params, req| begin id = req.params[

disabling character escaping in Flask's url_for function

折月煮酒 提交于 2019-12-07 02:50:52
问题 Does Flask's url_for method have an option to disable autoescaping? So if I have an endpoint called getUser with a route like this: /user/<userID> , I want to call url_for('getUser', userID='%') and have it return /user/% . Currently it will escape the % symobl and give out /user/%25 . I want to do that because url_for has to run at template compile-time, but the final URL is composed when a javscript script runs. I will be using a javascript string substitution method to convert /user/% into

MVC with Areas — Html.ActionLink returning wrong URL/Route?

有些话、适合烂在心里 提交于 2019-12-07 01:52:29
问题 I am using MVC3 and have Areas in my application. In general, everything works fine, I can navigate to my area (e.g. Admin=Area, Controller=Department) like this: <%: Html.ActionLink("Departments", "DepartmentIndex", "Department", new { area = "Admin"}, null )%> However, what I noticed is that if I don't specify the area in my ActionLink, e.g. <%: Html.ActionLink("Test", "Index", "Home")%> This will stop working if I have navigated to the "Admin" area. i.e. my url is now http://localhost

Rails 4 Method Not Allowed after Upgrading from Rails 3

最后都变了- 提交于 2019-12-07 01:35:12
问题 I've got an existing codebase that I'm attempting to upgrade from Rails 3.2 to Rails 4.0 I have controller called assets_controller with a 'create' method and I have a an entry in my routes file: resources :assets Using jQuery for ajax on the front end, if I send a post request to '/assets' from a browser, I get 405 (Method Not Allowed): $.ajax({method: 'POST', data: asset, url: '/assets' }); This worked just fine in Rails 3, and I can't seem to figure out what the issue is. Updates: Heres a