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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:02:11+00:00 2026-05-25T21:02:11+00:00

I am making a form for updating or saving a saved message. <% form_for

  • 0

I am making a form for updating or saving a saved message.

<% form_for @draft, :url => {:controller => "drafts", :action => "draft_actions"} do |f|%>

      subject
  <%=f.text_field :subject %>

      recipients
  <%=f.text_field :draft_recipients %>

 <br /> <%= f.text_area :body %>


      <%= submit_tag "save", :name => "resave_draft"%>
      <%= submit_tag "send", :name => "send_draft" %>

<% end %>

but I want the recipients to be displayed in a nice way, separated by commas : user1, user2, user3 instead of user1user2user3
My problem is : I don’t understand how to have the :recipients symbol map to my recipient attribute in my draft model, but still have the view displaying the recipients displayed how I want

The code for my draft model is

class Draft < ActiveRecord::Base

belongs_to :message
belongs_to :draft_recipient, :class_name => "User"
delegate :created_at, :subject, :user, :body, :draft_recipients,  :to => :message

The code for my Message model is the following

class Message < ActiveRecord::Base

belongs_to :user
has_many :recipients, :through => :message_copies
has_many :draft_recipients, :through => :drafts
has_many :message_copies
has_many :drafts, :class_name => "Draft", :foreign_key => :message_id

attr_accessor :to #array  of people to send to
attr_accessible :subject, :body, :to, :recipients, :author, :user

I’m sure there’s a fairly straightforward way to do that, but I can’t get my head around it.

  • 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-25T21:02:12+00:00Added an answer on May 25, 2026 at 9:02 pm
    <%=f.text_field :draft_recipients, :value => @draft.draft_recipients.join(',') %>
    

    Might work out for you. However, are you handling the conversion back in the controller? This won’t bind exactly right when you submit.

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

Sidebar

Related Questions

I'm making a form_tag panel that contains information (checkboxes) specific to a controller action.
I am making a form to search for colleges based on athletic programs offered
I'm making a form at the bottom of the screen and I want it
Short version: I want to trigger the Form_Load() event without making the form visible.
I'm making a simple form to create polls, therefore I want the possibility to
I am making a custom form object in Django which has an overrided __init__
I'm making a simple form that is to step through a program iteratively. How
I've been making this login form in C# and I wanted to 'submit' all
I'm having a little bit of trouble making a sticky form that will remember
In the days of version 3.x of Apache Commons HttpClient, making a multipart/form-data POST

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.