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 8166099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:44:41+00:00 2026-06-06T19:44:41+00:00

im trying to make a simple search on my database from the index action

  • 0

im trying to make a simple search on my database from the index action instead of listing all the data

this is my users/index

<%= form_tag do %>
<fieldset>
    <div class="row">
        <div class="span5 offset3">
            <h2>Enter the CPF number of the user to be managed: </h2></br></br></br>
            <div>
                <%= label_tag :cpf_no, 'CPF Number:' ,class:"left_align" %>
                <%= number_field_tag :cpf_no, params[:cpf_no] %>
            </div>
            <div>
                <%= button_to  "     Find     ", users_find_path , class: "btn btn-large btn-primary" %></br></br>
            </div>
        </div>
    </div>
  </fieldset>
<% end %>

and this is the find method in my controller:

 class UsersController < ApplicationController   
  ...
def find 
if request.post?
@user = user.find_by_cpf_no(params[:cpf_no])
redirect_to edit_user_path(@user.id)
end     
end 
...
end

and this are my routes now:

              root        /                                home#index
             login GET    /global/login(.:format)          sessions#new
                   POST   /global/login(.:format)          sessions#create
            logout DELETE /global/logout(.:format)         sessions#destroy
        users_find POST   /global/users/find(.:format)     users#find
             users GET    /global/users(.:format)          users#index
                   POST   /global/users(.:format)          users#create
          new_user GET    /global/users/new(.:format)      users#new
         edit_user GET    /global/users/:id/edit(.:format) users#edit
              user GET    /global/users/:id(.:format)      users#show
                   PUT    /global/users/:id(.:format)      users#update
                   DELETE /global/users/:id(.:format)      users#destroy
            fields GET    /global/data(.:format)           fields#index
                   POST   /global/data(.:format)           fields#create
         new_field GET    /global/data/new(.:format)       fields#new
        edit_field GET    /global/data/:id/edit(.:format)  fields#edit
             field GET    /global/data/:id(.:format)       fields#show
                   PUT    /global/data/:id(.:format)       fields#update
                   DELETE /global/data/:id(.:format)       fields#destroy

the problem is it doesnt go to the :id/edit path… it instead calls the create method which gives a few errors because the validations didnt pass. how do i make it access find method?

  • 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-06T19:44:43+00:00Added an answer on June 6, 2026 at 7:44 pm

    You should put the path right in your form_tag.

    form_tag user_find_path, :method => :post
        # other code
        = submit_tag "Find"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a bit urgent! I'm trying to make a simple filter search where-by
I've been trying to make a simple search inside a static HTML page using
Afternoon, I am trying to make a simple search, which is working for the
new to c#. I'm trying to make a simple system where I can search
I'm trying to make simple website with content background combined from 3 images: top
I'm trying to make simple script using jquery $post function to pass data to
Trying to make a simple number clicker control for BlackBerry 6/7, like this: At
so I am trying to make a simple search engine, that allows a user
I am trying to make a search form that will help users filter their
I'm trying to make a simple search and return results in a paginated form.

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.