I decided to create a restful controller for the tags, nested in the
users resources, and not associated with any model:

  resources :users do
    resources :utags, :only => [:index, :create, :destroy]
  end

I'm using these routes in the views:

  <%= link_to 'destroy', user_utag_path(@user, tag), :method
=> :delete %>

  <%= form_tag user_utags_path(@user) do %>

And in the controller (no error handling for now):

    create:
    tag = Tag.find_or_create_by_name(params[:name])
    @user.tags << tag

    destroy:
    tag = Tag.find(params[:id])
    @user.tags.delete(tag)

I think that this is a satisfactory solution.

--
Adriano

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to