Gibberish Db plugin
Plugin details
Documentation
Install the plugin:
ruby script/plugin install http://www.eppsteins.net/rails-plugins/gibberish_db/rdoc/index.html
== Installation
Migrate your database like so:
def self.up create_table "languages" do |t| t.column :name, :string, :null => false, :limit => 15, :unique => true end create_table "translations" do |t| t.column :language_id, :integer, :null => false t.column :key, :string, :null => false, :limit => 100 #max length for a column used in an index in mysql t.column :value, :text t.column, :format, :string, :null => false, :default => "inline" end add_index :translations, [:language_id, :key], :name => :one_translation_per_language, :unique => true end def self.down drop_table "languages" drop_table "translations" end
Add this to your environment.rb:
config.after_initialize do Gibberish.load_languages! rescue nil #if you don't rescue, you'll crash during migrations end
== Usage
Use is the same as before only the strings will come from your database now.
You can now use the following models:
* Gibberish::Language
* Gibberish::Translation
Translation cache is automatically expired after save, but if you add a new language, you'll need to call Gibberish.load_languages! again.
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | (0 older versions) | Last edited by: Guest, 10 months ago

