automatically create an object if it doesn't exist?

I want an action that will take a url like

and check to see if baz exists, and if not, create a new one with

This seems like it should be simple, but I just can't figure it out.
I've got the part that redirects to showing the item if it exists, but
I can't for the life of me figure out how to redirect this to a create
method (which would require using POST instead of GET). any ideas?

No need to redirect, just do your business in the action:

item = Item.find_or_create_by_name(params[:bar])