Class: TagList
- Inherits:
-
Array
- Object
- Array
- TagList
- Defined in:
- lib/tag_list.rb
Overview
Simple extension of Array. The reason we need this class is so that we can make form views play nicely with our tags.
For example, we can now write things like this in our form views:
form_for(@taggable_model) do |f|
<div class="field">
<%= f.label :tag_list %>
<%= f.text_field :tag_list %>
</div>
end
This will create a text field as we would expect, and will properly update our model’s tags when our model is being changed.
Instance Method Summary collapse
Instance Method Details
#to_s ⇒ Object
16 17 18 |
# File 'lib/tag_list.rb', line 16 def to_s self.join " " end |