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

  • Home
  • SEARCH
  • 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 5947885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:01:43+00:00 2026-05-22T17:01:43+00:00

hi i am using show_for gem and it gives me error like: undefined method

  • 0

hi i am using show_for gem and it gives me error like: undefined method `to_key’ for # in app/views/messages/index.html.erb where line #46 raised:

my view look like these:

46:   <%= show_for @messages do |s|  %>
47:     <%= s.attribute :subject  %>
48:     <%= s.attribute :message %>
49:   <% end %>

my controller code look like:

@messages= Message.all

please help me what i am doing wrong. thanks in advance

  • 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-05-22T17:01:44+00:00Added an answer on May 22, 2026 at 5:01 pm

    I do not know this gem but according to its documentation, show_for is not supposed to receive a collection as argument (@messages) but a single object. I might be wrong.

    With this supposition, I would to :

    <% @messages.each do |message| %>
      <%= show_for message do |s|  %>
        <%= s.attribute :subject  %>
        <%= s.attribute :message %>
      <% end %>
    <% end %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the sample app for rpx_now gem ( http://github.com/grosser/rpx_now_example ) on localhost:3000, I have
I'm using the Devise gem and I just would like to show a successful
Im using the following guide for getting started with rails for ubuntu 9.10. http://guides.rails.info/getting_started.html
I think I am missing something while using the Authlogic gem w/ Rails. To
I am using discogs-wrapper gem to access some music information, but I noticed that
I'm using a twitter gem which basically accesses twitter and lets me grab tweets,
I have a multi-tenant application and I'm experimenting with using the i18n gem to
Projects habtm Tasks On tasks/show.html.erb I have link_to Add This Task To Project, new_project_path(:task
I'm using Ruby 1.9 and Rails 2.3.4 with Paperclip gem to save attachments. and
I using devise gem for registration but i have problem. my table include: first_name,

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.