Displaying 2 results from an estimated 2 matches for "find_by_foo_and_bar".
2006 Aug 03
6
create or update -
Hi everyone,
I''m looking for a shortcut to finding and updating or creating record
depending on the results of the find.
So, is there a shorter way to do it than this?
@stuff = Stuff.find_by_foo_and_bar("yay","hooray")
if @stuff: Stuff.update(@stuff.id, {:foo => "boo", :bar => "hoo"})
else Stuff.create({:foo => "boo", :bar => "hoo"})
end
By the way, I can''t believe that I want to do this in less than 3.1
l...
2006 Nov 07
2
find_by_tag
What exactly is find_by_tag for? The rails documentation doesn''t really
give a description of what it does. I tried doing a search for
find_by_tag (and find_all_by_tag), but nothing turned up.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: