Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8021879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:06:50+00:00 2026-06-04T22:06:50+00:00

I have a problem with routes.rb In my web application i have two pages

  • 0

I have a problem with routes.rb

In my web application i have two pages with the login form

“/home/index” and “/users/index”

This is my routes file

  controller :home do
    get     'login'   => :index
    post    'login'   => :create
  end

  controller :users do
    get     'login'   => :index
    post    'login'   => :post_login
  end

  get "home/index"

  get "home/create"

  get "home/show"

  get "private/index"

  get "users/index"

  get "users/get_login"

  get "users/post_login"

  resources :users do
    collection do
      get  'get_login'
      post 'post_login'
    end
  end

the problem is that if i use login with my “home/index” it executes the right action “create” of the home controller, while if i login in “users/index” page it executes again the “create” instead of “post_login”, why?

The code i used for my form in “/home/index” and “/users/index” is the same…

This is the simple form

<%= form_tag do %>

    <table>
        <tr>
            <td>
                <%= text_field_tag :name, params[:name] %>
            </td>
        </tr>
        <tr>            
            <td>
                <%= password_field_tag :password, params[:password] %>
            </td>
        </tr>
        <tr>
            <td>
                <%= submit_tag "Login" %>           
            </td>
        </tr>
<% end %>
        <tr>            
            <td>
                <%= link_to 'Registrazione', users_index_url %>             
            </td>
        </tr>

    </table>

the users controller code:

class UsersController < ApplicationController


      def index

      end  

      def post_login
        redirect_to "http://www.google.it"
      end

    end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T22:06:51+00:00Added an answer on June 4, 2026 at 10:06 pm

    I would have users, only as resources:

     controller :home do
        get     'login'   => :index
        post    'login'   => :create
      end
    
      get "/users" => 'users#index'
      post "/users" => 'users#post_login'
    
    
      get "home/index"
    
      get "home/create"
    
      get "home/show"
    
      get "private/index"
    

    In the only array, just add the actions that u are using…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ok i got this problem. i have this routes: (code bit change) File:/home/dotcloud/current/config/routes.js exports.routes
currently I have a custom VirtualPathProvider in a Asp.net MVC web application. This VirtualPathProvider
I cannot find a solution with this problem. I have to join TWO MVC3
I am doing homework but I have problem with non-RestFul routes. My spec is:
I have a growing web application which now needs to be able to store
I have a web application with a category tree that is published on the
I again have problem with routing :) When I run application if user is
I'm trying to write an application server using Happstack, Heist, and web-routes, but am
I have created an ASP.Net MVC Web Application and used NuGet to install Ninject
I have an existing ASP.NET web application that I'm converting to MVC 1.0. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.