# No posts with name 'Active' exists, so a post is created and stored into post objectи прочие вещи можно узреть на
post = Post.find_or_create_by_name("Active")
# A post is found with the name 'Active' and stored into the post object
post = Post.find_or_create_by_name("Active")
# A new post object is create with its name 'Record' but is not saved into database
post = Post.find_or_initialize_by_name("Record")
http://www.jumbabox.com/2008/06/ruby-on-rails-dynamic-finders/
Комментариев нет:
Отправить комментарий