No commit activity in last 3 years
No release in over 3 years
Bizarroids Settings provides basic user editable settings for Rails
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 1.9.0
~> 4.1.2
~> 3.0.0
 Project Readme

Bizarroids Settings¶ ↑

Flexible settings for Rails application. This is a part of The Bizarroids.

Installation¶ ↑

Add it to your Gemfile:

gem 'bizarroids_settings'

Run the following command to install it:

bundle install

Run the generator:

rails generate bizarroids:settings:install

Configuraton¶ ↑

Edit config/initialisers/bizarroids_settings.rb. You can create options using folowing syntax:

config.option :key, :string, value: 'MyString', other: :options

Avaliable types:

  • string

  • integer

  • float

  • boolean

  • text

  • date

  • datetime

  • file

Avaliable options:

  • name - gives user readable name to the option. It would be show in admin panel.

  • description - description to show in admin panel.

  • require - if set true, prevents user to set empty value.

  • hidden - if set true, hides option from user in admin panel.

  • collection - (+collection: [1, 2, 3]+) forses user to select given values instead of enter in input field.

Some additional configuration can be found config/initialisers/bizarroids_settings.rb

Usage¶ ↑

Link for admin panel

bizarroids_settings_menu_link

If you use cancancan place in your ability.rb somthing like

can :manage, Bizarroids::Settings::Option

if don’t, place in config/initialisers/bizarroids_settings.rb

config.use_cancancan = false

To get value for :key

Get:

Bizarroids::Settings.get(:key)
Bizarroids::Settings[:key]

Set:

Bizarroids::Settings.get(:key) = 'my value'
Bizarroids::Settings[:key] = 'my value'

TODO¶ ↑

  • image styles for file field

  • Tests

This project rocks and uses MIT-LICENSE.