routing

Rails nested resource issue

懵懂的女人 提交于 2019-12-08 14:05:38
I have a couple of resources, a grant_application, and a household which are related with a has_one class GrantApplication < ActiveRecord::Base has_one :household, :dependent => :destroy end class Household < ActiveRecord::Base belongs_to :grant_application end ..and I also use the following route.. map.resources :grant_applications do |grant| grant.resource :household end However, I am having real problems when trying to create the form for /grant_applications/1/household/new Using <% form_for([:grant_application, @household]) do |f| %> returns an error: undefined method 'grant_households

Access session data from custom RouteHandler?

…衆ロ難τιáo~ 提交于 2019-12-08 13:32:52
问题 I am building onto the example found here: http://www.mikesdotnetting.com/Article/126/ASP.NET-MVC-Prevent-Image-Leeching-with-a-Custom-RouteHandler What I would like to do now is have some logic that checks for certain data in session before allowing the valid image to show. Is it possible to access session data from within the custom RouteHandler or any other type of persisted data? 回答1: You have access the session right from the requestContext: private static void ProcessRequest

Linking to location on page (#id) through ASP.NET MVC mechanisms?

纵然是瞬间 提交于 2019-12-08 13:31:43
问题 My example: I have a View that presents a set of div tags that has content populated from the datamodel. [Multiple of these, with different location_id, naturally] <div> <a name="location_id"></a> Content </div> Now, I have a form [in its own view] that submits content that adds another record to the datamodel. Once the record is create and submitted, I redirect back to the Action that returns the View with the <div> listing. My challenge: I'd like the page to focus the <div> block that was

Routing error in rendering partial form

我怕爱的太早我们不能终老 提交于 2019-12-08 12:18:43
问题 I'm making a project for which I have a class online_score which has as one of its attributes an array called url of online_score_url objects. What I did up to now is the following. The code might be a little dirty because I'm constantly trying new things, but as soon as I get it working, I'll clean it up. views/online_score/new: <h3>Links: </h3> <div class="urlInput"> <%f.fields_for :url do |f| %> <div class="inputset"> <%= f.label :url %> <%= f.url_field :url, :value => "http://www.google

Is there a way to put multiple parameters in routing parameters?

扶醉桌前 提交于 2019-12-08 11:48:32
问题 I have a route get '/catalog/:gender/' => 'catalog#gender' . The :gender param is used in my controller like so @products = Product.where(gender: params[:gender]).all . So I can use /catalog/male/ to get all male products and /catalog/female/ to get all female products. The question is, is there a way somebody could possibly pass both male and female parameters and get all the products? 回答1: You can pass /catalog/all/ to get all products, and in your controller: if params[:gender] == "all"

Reactivesearch - search from any route

99封情书 提交于 2019-12-08 08:35:07
问题 I'm experimenting with ReactiveSearch and using the ReactiveList component. I'm trying to figure out how I can navigate though my React app and still be able to search. Say I'm on the home route '/' , use DataSearch component for autocomplete and that takes me to the results page '/results but I don't get any results!! In order to get results, I have to search and stay on the '/results' page. Is there a prop that I'm missing on my DataSearch component in the Header: <DataSearch componentId=

Symfony-2 > login & logout routes with placeholders

北城以北 提交于 2019-12-08 08:28:29
问题 I am using Symfony-2 to implement my application. I need my login and logout routes to have some placeholders, but I don't manage to define it well in routing.yml and security.yml files. I want to have something like: www.mysite.com/{client_slug}/panel and under it other secured pages: www.mysite.com/{client_slug}/panel/.* When someone tries to navigate to one of these pages, he/she should be redirected to: www.mysite.com/{client_slug}/login and after clicking logout , user should be

MVC3 using routes or using controller logic?

流过昼夜 提交于 2019-12-08 07:37:51
问题 I'm relatively new with MVC3, but I'm using it, C# and EF4 to create an application website. The routing that I'm using is the same as in the default Microsoft project created when I selected MVC3 pattern, nothing special: public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter

routing problem in codeigniter

≡放荡痞女 提交于 2019-12-08 07:28:57
问题 I'm new to CodeIgniter and routing. I have a Login controller whose index() loads up a view to enter a username/password. In the view, the form has action="login/authenticate" . Login->authenticate() determines if the login is valid or not. If it's valid, redirect('lobby') , if not redirect('login') routes.php: $route['default_controller'] = "login" config.php: $config['base_url'] = "http://localhost/dts/"; $config['index_page'] = "index.php"; The problem is that when i go to http://localhost

Convert values of route parameters dynamically in Symfony 2

▼魔方 西西 提交于 2019-12-08 06:45:49
问题 I have route /track/Johnny+Cash/There+You+Go and I need route parameters artist_name="Johnny Cash", name="There You Go" (without pluses) For this I added listener in MainBundle\Resources\config\services.yml services: app.listener.location: class: Melofania\MainBundle\LocationListener scope: request tags: - { name: kernel.event_listener, event: kernel.controller } arguments: [] And created file MainBundle\LocationListener.php namespace Melofania\MainBundle; use Symfony\Component\HttpKernel