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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:42:41+00:00 2026-06-04T10:42:41+00:00

I built a feature in my app to allow users to search for images

  • 0

I built a feature in my app to allow users to search for images that would search the image description,member who uploaded it, and image tags but I have this weird issue where if I search for the name ‘jason’ it breaks, but a name like ‘jesse’ works just fine.

Here is my controller

  def search_results
    @tattoos = Tattoo.where("description LIKE ?", "%#{params[:search]}%") | Tattoo.tagged_with("#{params[:search]}", :any => true ) | Member.where("membername LIKE ?", "%#{params[:search]}%").order("created_at DESC").page(params[:page]).per(10)
  end

if i search for ‘jason’ my app breaks, giving me an ‘undefined method’ error and the console shows a bunch of stuff not shown if I searched for say, ‘jesse’. Im not entirely sure how to word that but here is what I mean.

Search – Jason

    Started GET "/search_results?utf8=%E2%9C%93&search=jason&commit=search" for 127.0.0.1 at 2012-05-23 20:48:26 -0400
  Processing by IndexController#search_results as HTML
  Parameters: {"utf8"=>"✓", "search"=>"jason", "commit"=>"search"}
  SQL (0.7ms)  SHOW TABLES
  ActsAsTaggableOn::Tag Load (0.3ms)  SELECT `tags`.* FROM `tags` WHERE (name LIKE 'jason')
  Tattoo Load (0.2ms)  SELECT `tattoos`.* FROM `tattoos` WHERE (description LIKE '%jason%')
  Tattoo Load (0.2ms)  SELECT `tattoos`.* FROM `tattoos` WHERE (1 = 0)
  SQL (0.7ms)  SHOW TABLES
  SQL (0.5ms)  SHOW TABLES
  Member Load (0.3ms)  SELECT `members`.* FROM `members` WHERE (membername LIKE '%jason%') ORDER BY fullname asc, created_at DESC LIMIT 10 OFFSET 0
  Member Load (0.3ms)  SELECT `members`.* FROM `members` WHERE `members`.`id` = 7 ORDER BY fullname asc LIMIT 1
  ActsAsTaggableOn::Tag Load (0.3ms)  SELECT `tags`.* FROM `tags` INNER JOIN `taggings` ON `tags`.id = `taggings`.tag_id WHERE ((`taggings`.taggable_id = 43) AND (`taggings`.taggable_type = 'Tattoo')) AND (taggings.context = 'styles' AND taggings.tagger_id IS NULL)
Rendered shared/_image_roll.html.erb (27.5ms)
Rendered index/search_results.html.erb within layouts/application (29.3ms)
Completed 500 Internal Server Error in 523ms
  Processing by ErrorsController#internal_server_error as HTML
  Parameters: {"utf8"=>"✓", "search"=>"jason", "commit"=>"search"}
  SQL (0.7ms)  SHOW TABLES
  SQL (0.5ms)  SHOW TABLES
Rendered shared/_register.html.erb (483.4ms)
  Member Load (0.2ms)  SELECT `members`.* FROM `members` WHERE `members`.`id` = 7 ORDER BY fullname asc LIMIT 1
  MemberRole Load (0.2ms)  SELECT `member_roles`.* FROM `member_roles` WHERE (`member_roles`.member_id = 7) LIMIT 1
  SQL (0.6ms)  SHOW TABLES
  SQL (0.4ms)  SELECT COUNT(*) FROM `tattoos` WHERE `tattoos`.`status` = 'pending'
  SQL (0.2ms)  SELECT COUNT(*) FROM `feedbacks` WHERE `feedbacks`.`approved` = 0
  SQL (0.1ms)  SELECT COUNT(*) FROM `tattoos` WHERE `tattoos`.`status` = 'reported'
Rendered shared/_navbar.html.erb (87.6ms)
Rendered shared/_login_form.html.erb (2.9ms)
Rendered errors/internal_server_error.html.erb within layouts/application (582.4ms)
Completed 500 Internal Server Error in 587ms (Views: 583.9ms | ActiveRecord: 3.5ms)

ActionView::Template::Error (undefined method `member' for #<Member:0x007f0b0ca077b0>):
    1:   <ol class="image_roll">
    2:     <% @tattoos.each do |t| %>
    3:  <li>
    4:         <% unless t.member.nil? %>
    5: 
    6:           <%= link_to image_tag(t.file.url(:small),:alt=>"#{strip_tags(t.description)}, #{t.style_list}, tattoos"), member_tattoo_path(t.member, t)%>
    7:         <% else %>
  app/views/shared/_image_roll.html.erb:4:in `block in _app_views_shared__image_roll_html_erb__3185787815883689760_69842755443480_3152220748446100192'
  app/views/shared/_image_roll.html.erb:2:in `each'
  app/views/shared/_image_roll.html.erb:2:in `_app_views_shared__image_roll_html_erb__3185787815883689760_69842755443480_3152220748446100192'
  app/views/index/search_results.html.erb:10:in `_app_views_index_search_results_html_erb___3497910042066847338_69842586729040__4333294961394575926'

Search – Jesse:

Started GET "/search_results?utf8=%E2%9C%93&search=jesse&commit=search" for 127.0.0.1 at 2012-05-23 20:48:36 -0400
  Processing by IndexController#search_results as HTML
  Parameters: {"utf8"=>"✓", "search"=>"jesse", "commit"=>"search"}
  ActsAsTaggableOn::Tag Load (0.6ms)  SELECT `tags`.* FROM `tags` WHERE (name LIKE 'jesse')
  Tattoo Load (0.7ms)  SELECT `tattoos`.* FROM `tattoos` WHERE (description LIKE '%jesse%')
  Tattoo Load (0.1ms)  SELECT `tattoos`.* FROM `tattoos` WHERE (1 = 0)
  Member Load (0.5ms)  SELECT `members`.* FROM `members` WHERE (membername LIKE '%jesse%') ORDER BY fullname asc, created_at DESC LIMIT 10 OFFSET 0
Rendered shared/_search.html.erb (0.8ms)
  ActsAsTaggableOn::Tag Load (0.2ms)  SELECT tags.*, taggings.tags_count AS count FROM `tags` JOIN (SELECT taggings.tag_id, COUNT(taggings.tag_id) AS tags_count FROM `taggings` INNER JOIN tattoos ON tattoos.id = taggings.taggable_id WHERE (taggings.taggable_type = 'Tattoo' AND taggings.context = 'styles') AND (taggings.taggable_id IN(SELECT tattoos.id FROM `tattoos`)) GROUP BY taggings.tag_id HAVING COUNT(taggings.tag_id) > 0) AS taggings ON taggings.tag_id = tags.id ORDER BY count DESC LIMIT 40
Rendered index/_tags_list.html.erb (19.7ms)
Rendered layouts/shared/_right_column_std.html.erb (22.3ms)
Rendered shared/_register.html.erb (5.7ms)
  Member Load (0.3ms)  SELECT `members`.* FROM `members` WHERE `members`.`id` = 7 ORDER BY fullname asc LIMIT 1
  MemberRole Load (0.1ms)  SELECT `member_roles`.* FROM `member_roles` WHERE (`member_roles`.member_id = 7) LIMIT 1
  SQL (0.2ms)  SELECT COUNT(*) FROM `tattoos` WHERE `tattoos`.`status` = 'pending'
  SQL (0.1ms)  SELECT COUNT(*) FROM `feedbacks` WHERE `feedbacks`.`approved` = 0
  SQL (0.1ms)  SELECT COUNT(*) FROM `tattoos` WHERE `tattoos`.`status` = 'reported'
Rendered shared/_navbar.html.erb (13.5ms)
Rendered shared/_login_form.html.erb (2.9ms)
Rendered index/search_results.html.erb within layouts/application (54.3ms)
Completed 200 OK in 64ms (Views: 57.9ms | ActiveRecord: 3.0ms)

And the view:

<% @tattoos.each do |t| %>
    <% unless t.member.nil? %>

      <%= link_to image_tag(t.file.url(:small),:alt=>"#{strip_tags(t.description)}, #{t.style_list}, tattoos"), member_tattoo_path(t.member, t)%>
    <% else %>
      <%= link_to image_tag(t.file.url(:small),:alt=>"#{strip_tags(t.description)}, #{t.style_list}, tattoos"), tattoo_path(t) %>
    <% 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-04T10:42:43+00:00Added an answer on June 4, 2026 at 10:42 am

    One thing I noticed is that you are using | instead of || in

    @tattoos = Tattoo.where("description LIKE ?", "%#{params[:search]}%") | Tattoo.tagged_with("#{params[:search]}", :any => true ) | Member.where("membername LIKE ?", "%#{params[:search]}%").order("created_at DESC").page(params[:page]).per(10)

    perhaps that might be part of the issue?

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

Sidebar

Related Questions

We have a web app that has a built-in search feature that our users
Is there any built-in api/code for Xcode that allow the app to detect what
I have an already built application and I want to add a feature that
I want to launch the iMessage app (built in new feature for iOS 5)
I built an app in php where a feature analyzes about 10000 text files
I've built my first app, and I would like to password protect it. It's
I've built a web platform where one small feature allows users to contribute data
I'm writing an app that will feature SSO via Twitter. So far, using the
I have an app that I would like to add a blog to. I'd
I am trying to create an app with a built in chat feature. 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.