Skip to content

Commit

Permalink
made use of find_or_create_by_name
Browse files Browse the repository at this point in the history
  • Loading branch information
parndt committed Sep 1, 2009
1 parent 2d71d29 commit 899f1d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions vendor/plugins/inquiries/app/models/inquiry_setting.rb
@@ -1,11 +1,11 @@
class InquirySetting < ActiveRecord::Base

def self.confirmation_body
find_by_name("Confirmation Body")
find_or_create_by_name("Confirmation Body")
end

def self.notification_recipients
find_by_name("Notification Recipients")
find_or_create_by_name("Notification Recipients")
end

end
Expand Up @@ -41,7 +41,7 @@ def self.[](name)
end

def self.[]=(name, value)
setting = find_by_name(name.to_s) || new(:name => name.to_s)
setting = find_or_create_by_name(name.to_s)
setting.value = value
setting.save!
end
Expand Down

0 comments on commit 899f1d4

Please sign in to comment.