Skip to content

@olivoil /tags_input.rb forked from ches/tags_input.rb
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
# Example simple_form input builder to render tags from an Array field,
# for use with my fork of mongoid_taggable:
#
# https://github.com/ches/mongoid_taggable
#
# Once you've configured your app to load this, use it in forms thusly:
#
# <%= f.input :tags, :as => :tags %>
#
module SimpleForm
module Inputs
class TagsInput < StringInput
protected
def html_options_for(namespace, extra)
formatted_tags = object.send("#{attribute_name}").
try(:join, "#{object.send(:tags_separator)} ")
super.merge(:value => formatted_tags)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.