Skip to content

acid/Settings-Magic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SettingsMagic
=============

It's a little plugin written for a weird project where I came to after some years of development.
It assumes that you have a AR class Setting where all your settings come from and that classes have methods which return an array of fields, for which these classes needs settings for.


Example
=======

In your Setting class:

settings_for "Article", :custom_fields

generates:

def self.articles_custom_fields
  result = []
  Article.custom_fields.each do |f|
    result << Setting.find_or_create_by_name({ :name => "article_"+f, :wert => f.humanize })
  end
  result
end

Copyright (c) 2010 Daniel Schweighöfer, released under the MIT license

About

A little Activerecord Plugin for a weird data-structure. Maybe useful for somebody

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages