RubyGems Navigation menu

rails_config_model_generator 1.2.2

DESCRIPTION: Creates a configuration controller and model that can be used to quickly create configuration table for your system so you can store system-wide variables that you’d like the user to be able to set. This gem contains a generator to create a simple configuration model, migration, and interface for your application, complete with working tests. == FEATURES * Generates the controller, model, and the associated files. * You can specify the model name and set the fields for the migrations via the generator. == SYNOPSIS: === Setup and overview Generate a new configuration system for your application by executing the generator from the root of your application. ruby scriptgenerate rails_config_model Configuration You can also specify the model fields much like the scaffold_resource generator ruby script/generate rails_config_model Configuration contact_email:string site_name:string welcome_message:text max_number_of_events:integer Once installed, you modify the generated migration to include the fields you want to configure. There are a few defaults there to give you an idea. The generator will create a controller mounted at /configuration so you can edit your configurations. Modify this as needed to provide for security. === The Edit form The application’s edit form uses the form helper method to auto-generate the fields. This may not be optimal and you may wish to actually write your own view instead. See app/views/configuration/edit.rhtml for more details. === Usage Configuration is simply a model for this table. It is designed to handle a single row of a table, and so additional rows cannot be created. If you have a table that looks like this: id contact_email site_name welcome_message max_number_of_events You simply grab the row from the table @configuration = Configuration.load and then grab the values out. email = @configuration.contact_email Or save new values @configuration = Configuration.load @configuration.welcome_message = "This is the default message." @configuraiton.save

Gemfile:
= 复制到剪贴板 已复制!

安装:
=

版本列表:

  1. 1.2.2 - June 06, 2009* (9.0 KB)
  2. 1.2.1 - April 22, 2009* (9.0 KB)
  3. 1.1.0 - October 25, 2007* (9.0 KB)

Development 依赖 (1):

hoe >= 1.12.2

业主:

作者:

  • Brian Hogan

SHA 256 校验和:

d07b17f0e22cb8e5f71b9d0ba145aac4e89553ce9dbd15643f2660227ee9238c

下载总量 11,690

这个版本 4,966

许可:

需要的 Ruby 版本:

链接: