Linda Coleman wrote:> I''m new to RoR & trying to use the acts_as_taggable gem. It
works great
> if I use the default separator. However, I want to let users create tags
> w/spaces in them so the default won''t work for me. I''m
not clear how to
> use the :separator option in conjunction with the view. I can get the
> objects to display ok by looping through the tag_names, but when they
> get saved it seems to be using the space separator even before it gets
> to the controller. A lot of automagic stuff is going on that I
haven''t
> deciphered yet. :)
>
> What''s the best way to go about this??
>
> It would be nice if I could define the separator in the model with
> something like the acts_as_taggable :separator => "," or even
something
> like <%= text_area(''photo'',
''tag_names'', {:separator => ","}) %> in the
> .rhtml file.
Hi Linda,
My suggestion to you is to create a tag_names helper on the view that
would allow you to do something like this:
<%= tag_names_text_area(@photo, :separator => '','') %>
Inside the helper you would have to have some presentation logic like this:
def tag_names_text_area(object, options = {})
text = @photo.tag_names.join(options[:separator])
...
end
Or simply use the text_area_tag helper directly on the view like this:
<%= text_area_tag ''photo[tag_names]'',
@photo.tag_names.join('', '') %>
I hope this is enough to help you get on track with it.
Rgds
Dema
--
http://dema.ruby.com.br - Rails from a .NET perspective