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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:31:07+00:00 2026-06-12T09:31:07+00:00

I am creating a virtual attribute in my model: def entities @entities = Array.new()

  • 0

I am creating a virtual attribute in my model:

def entities
  @entities = Array.new()
  @entities.push(self.contact.name)
  @entities.push(self.contact.partner.name) if self.contact.partner
  @entities.push('Joint') if self.contact.partner
  @entities
end

Then in my form I’m trying to use this array from a nested array. I’m using simple form so it looks like this

<%= f.input :ownership, collection: :entities, :include_blank => false, :label => false %>

However this gives me an error:

undefined method `to_a' for :entities:Symbol

If I have created an array, I don’t understand why it isn’t rendering as an array. What am I missing?

  • 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-12T09:31:08+00:00Added an answer on June 12, 2026 at 9:31 am

    You can’t use :entities as the collection:

    <%= f.input :ownership, collection: :entities ...%>
    

    That doesn’t work. The error indicates that Simple Form is attempting to convert the argument :entities to an array, which is causing an error.

    You need to give it an actual collection:

    <%= f.input :ownership, collection: @object.entities ... %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a model, Foo, that has_many Bars. It has a virtual attribute, current_baz,
I am creating new virtual device using ubuntu gelelio@ubuntu:/media/Android/eclipse-linux/android-sdk-linux_x86/tools$ ./android I have create new
I'm pretty new to Python, and programming in general and I'm creating a virtual
Folks, i am creating a new attribute which inhetirs from System.Web.Mvc.RemoteAttribute. I would like
I'm creating a script to automate the creation of apache virtual hosts. Part of
Ok, I am creating an app that serves as a virtual catalog for certain
I'm write installer for my web site. Installer creating application pool, virtual directory and
Creating a class at runtime is done as follows: klass = Class.new superclass, &block
I've created a new subdomain for all static assets (static.example.com) by creating a new
I am using a virtual attribute called :all_dates on my form . The point

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.