public
Description: The open source social networking platform in Ruby on Rails from the author of RailsSpace
Homepage: http://insoshi.com
Clone URL: git://github.com/insoshi/insoshi.git
insoshi / app / helpers / preferences_helper.rb
100644 14 lines (12 sloc) 0.517 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module PreferencesHelper
 
  # Return the global preferences.
  # The separate line for test mode lets the tests change the global prefs
  # on a test-by-test basis. Without that line, changes to the prefs
  # don't show up because of the ||=. Usually, this is a feature (avoiding
  # the redundant database hits is the whole point of using ||= here), but
  # in test mode it's a pain in the ass.
  def global_prefs
    return Preference.find(:first) if test?
    @global_prefs ||= Preference.find(:first)
  end
end