1
<%= f.input :body, 'Send Update:' %>

This returns a Symbol to Integer error.

I need the box to be titled 'Send Update:' and not 'Body'

4
  • What you mean by titled? Its name should be send_update? Commented Oct 9, 2014 at 20:31
  • In my :updates table, the column is called body. But when users go to the form, i want that text box labeled "Send Update" or something different. Commented Oct 9, 2014 at 20:32
  • Something like this?: Send Update: [heres your f.input] ? Commented Oct 9, 2014 at 20:33
  • 'Body:' still shows up. Commented Oct 9, 2014 at 20:34

2 Answers 2

3

From documentation:

<%= simple_form_for @user do |f| %>
  <%= f.input :username, label: 'Your username please' %>
  <%= f.input :remember_me, inline_label: 'Yes, remember me' %>
  <%= f.input :email, label_html: { class: 'my_class' } %>
  <%= f.input :password_confirmation, label: false %>

  <%= f.button :submit %>
<% end %>
Sign up to request clarification or add additional context in comments.

Comments

2

Perhaps what you are looking for its for a label/text to precede your input? You could write it on plain text, assuming your view is an html.erb file: (using table for display convenience)

<table>
 <tr>
  <td>Send Update: </td>
  <td><%= f.input :body %></td>
 </tr>
</table>

Or use the f.label:

<table>
 <tr>
  <td><%= f.label :body, "Send Update:" %></td>
  <td><%= f.input :body %></td>
 </tr>
</table>   

UPDATE: Doing some research, found out that this could work too:

<%= f.input :body, label: "Send Update:" %>

3 Comments

No. this just creates a table. I am using simple_form_for. not Form_for.
I stated that the use of "table" was for displaying convenience. Its completely optional.
Update did it. Im guessing i forgot a comma or something before. Thanks a lot Oscar!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.