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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:01:34+00:00 2026-05-20T06:01:34+00:00

In my RoR application, i have a rjs file which is populating a field

  • 0

In my RoR application, i have a rjs file which is populating a field with id "submission_references" found in my main form.

RJS code:

  page[:submission_references].value = @references.each do |reference|
                                       reference.NAME
                                       end

The problem is that instead of displaying the retrieved database value, the following is being displayed in the 'submission_references' field:

[object Object],[object Object]

However if i put something like @references[0].NAME, the first retrieved record’s name is displayed in the field.

Please can someone shed some light on this for me.

Many many thanks for your precious help

  • 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-20T06:01:34+00:00Added an answer on May 20, 2026 at 6:01 am

    Try:

    page[:submission_references].value = 
      (@references.map {|reference| reference.NAME}).join(", ")
    

    A little explanation: in your code you have assigned to the value a result of each loop, which returns original array of objects (not the evaluated inside block). That is why you get that [object Object],[object Object] string. On the other side map iterates over a collection and it evaluates block for each object in collection. Evaluated values are then returned in array instead of orginal objects. Since NAME is a string, you can use join(", ") to join each element of an array into one string concacted with “, ” string.

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

Sidebar

Related Questions

I have a RoR application (ruby v1.8.7; rails v2.3.5) that is caching a page
i have an RoR application Log, which similar to the book store app, my
I modify my RoR application to calling a create.js.rjs after created an item. I
We have RoR application and we are planning to make js interface(extjs or closure)
Hi I have to have a popup WYSIWYG editor into my ROR application. I
I have an action in my RoR application, and it calls a different script
Here, I have a problem in searching record in Postgresql DB in RoR Application.
I have a ruby-on-rails application and I'm now wondering why RoR uses Restful Requests:
I'm learning RoR through this tutorial . In tute, an application.html.erb file is created
I am developing RoR application that works with legacy database and uses ActiveScaffold plugin

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.