github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

caring / gibberish_db

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 10
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Store translation strings in the database allowing you to update text without requiring a code deploy. — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

A touch of logging when loading stuff. 
dustin (author)
Thu Apr 24 13:04:40 -0700 2008
dustin (committer)
Thu Apr 24 13:06:34 -0700 2008
commit  4de276f7ccbb0dec3e7dc68d8da8b4da1e5318f1
tree    bd8096e99aa9014379a55b6269c512ead31e124f
parent  f29a9a3715153621c32c2cec6e560a4f19e07d14
gibberish_db /
name age
history
message
file README Wed Mar 19 22:13:32 -0700 2008 putting gibberish_db up on git hub [chriseppstein]
file Rakefile Wed Mar 19 22:13:32 -0700 2008 putting gibberish_db up on git hub [chriseppstein]
directory ext/ Wed Mar 19 23:09:37 -0700 2008 controller, javascript to enable inline editing... [chriseppstein]
file init.rb Mon Apr 21 16:17:11 -0700 2008 Less code to do the same work in the after filter. [dustin]
file install.rb Wed Mar 19 22:13:32 -0700 2008 putting gibberish_db up on git hub [chriseppstein]
directory lib/ Thu Apr 24 13:06:34 -0700 2008 A touch of logging when loading stuff. [dustin]
directory tasks/ Wed Mar 19 22:13:32 -0700 2008 putting gibberish_db up on git hub [chriseppstein]
directory test/ Wed Mar 19 22:13:32 -0700 2008 putting gibberish_db up on git hub [chriseppstein]
file uninstall.rb Wed Mar 19 22:13:32 -0700 2008 putting gibberish_db up on git hub [chriseppstein]
README
GibberishDb
===========
This plugin adds database support to Gibberish (http://errtheblog.com/posts/55-ya-talkin-gibberish) allowing
you to store (and change) your strings in your database. This probably is a bad idea unless you have a copy-editor
who is always bugging you to change the text on your website. Strings are cached using acts_as_cached to minimize the
database impact.

Author:: Chris Eppstein (chris@eppsteins.net)
Copyright:: (c) Copyright 2008 Caring, Inc. All Rights Reserved.
License:: Released under the same licensing terms as Gibberish

== 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
  
== Dependencies
* Gibberish (duh!)
* acts_as_cached (or cache_fu)

== 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.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server