checkbox - simple_form (rails) displays extra characters (-- "0") -


i used simple_form , devise (ror gems) make new user , edit user form. added checkbox feature users can select payment methods accept. however, after filling , updating form, user page generates dashes, zeroes , other symbols while displaying checked items.

example: (when updated form, checked "debit card" , "paypal". comes out:

payment methods accepted: --- - debit card - paypal - ''

i know might silly question, does know how can rid of unnecessary symbols? i'm complete beginner in ror , struggling understand codes.

for edit.html.erb (which user visits view profile page), used following codes:

    <%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => {:method => :put, class: 'form-horizontal'}) |f| %>   <%= f.error_notification %>  <%= f.input :name %> payment methods accepted:     <%= @user.paymode %> <div class="checkboxes"> <p>     <%= f.collection_check_boxes :paymode, [['cash', 'cash'] ,['credit card', 'credit card'] ,['debit card', 'debit card'] ,['paypal', 'paypal']], :first, :last, {:item_wrapper_class => 'checkbox_container'} %>     </div> 

this defined under user.controller.rb file

    class userscontroller < applicationcontroller       def show        @user = user.find(params[:id]) end 

also, give quick background: attempted implement acts_as_taggable_on simple_form , devise filter users later on paymode (payment methods). however, did not work out, simplified this. removed tagging-related codes after that. have relation symbols i'm getting?

thanks , appreciated!

without understanding paymode is, it's difficult say.

so far sounds you're directly displaying collection of payment modes, e.g., calling .to_s on enumeration.

you should loop on them , explicitly display each instead, roughly:

this assumes each paymode associated object id , human-readable name. explain @ least of "garbage" output you're seeing.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -