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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:50:30+00:00 2026-05-16T06:50:30+00:00

I have Exam controller. In routes.rb there is resources :exams In controller there are

  • 0

I have Exam controller.

In routes.rb there is “resources :exams”

In controller there are REST-like generated methods.

I want to add my own method there:

def search
  @exams = Exam.where("name like ?", params[:q])
end

In view file:

<%= form_tag(search_path, :method => "post") do %>
  <%= label_tag(:q, "Szukaj: ") %>
  <%= text_field_tag(:q) %>
  <%= submit_tag("Szukaj") %>
<% end %>

I know, there is no results presentation yet, it doesn’t work at all at this moment (:

When i go to http://localhost:3000/exams/search it’s mapping it to show controller and search is a :id paramether then…

How to get http://localhost:3000/exams/search to run the seach controller?

  • 1 1 Answer
  • 2 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-05-16T06:50:30+00:00Added an answer on May 16, 2026 at 6:50 am

    You forgot to add route. Put this in routes.rb, before resources :exams

    map.search '/exams/search', :controller => :exams, :action => :search
    

    Note, that resources :exams doesn’t generate routes for all public methods of the controller, it generates very specific set of routes. You can find more information in the rails routing guide. (see section 3.2 in particular)

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

Sidebar

Related Questions

I have an exam and I would like to print my Java (in NetBeans
Hey guys, I have a CS exam tomorrow. Just want to get a few
I have XML like this: <exam> <section name=SampleSection1> <attributes> <variable_name data_type=String value=SCORE/> </attributes> <item
Hey all yesterday i have given my GATE exam and in this exam there
this is really hard question. I have an exam. And questions will be like
I have this Exams table and Responses table. I want to fetch all records
Possible Duplicate: PHP __get and __set magic methods I have an exam question on
I have an exam tomorrow and I was trying to understand this doubly linked
I have a practice exam for my compilers course with the following questions that
I have a file that stores exam scores for a class of students. I

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.