Skip to content

Instantly share code, notes, and snippets.

@granolocks
Created April 17, 2013 01:08
Show Gist options
  • Select an option

  • Save granolocks/5400989 to your computer and use it in GitHub Desktop.

Select an option

Save granolocks/5400989 to your computer and use it in GitHub Desktop.
pseudo code
class AppConfig < ActiveRecord::Base # Or whatever, its a model
attr_accessible :homepage_template, :connection_password, :i_dunno_whatever
# bear with me, its all pseudo code
validates :homepage_template, :presence => true, :inclusion => { :in => MagicalTemplateHelper.homepage_templates }
validates_presence_of :connection_password
# settings for arbitrary shit we need to set
# these are way hard to validate
# and require a lot of conditional b/s
# for the application to take them seriously
# in terms of behavior
has_many :settings
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment