Skip to content
This repository has been archived by the owner on Sep 9, 2021. It is now read-only.

saks/acts_as_describable

Repository files navigation

= acts_as_describable

== Installation

  ruby script/plugin install git://github.com/saks/acts_as_describable.git

== Usage

=== Prepare database

Generate and apply the migration:

  ruby script/generate acts_as_describable model_name
  rake db:migrate

=== Basic descripting

Let's suppose users have many products and we want those products to have multilanguage descriptions.
The first step is to add +acts_as_describable+ to the Product class:

  class Product < ActiveRecord::Base
    acts_as_describable
  end

We can now use the description method provided by acts_as_describable, <tt>#description</tt> and <tt>#set_description!</tt>.

  p = Product.find(:first)
  p.description # ''
  p.set_description!(:short, :en, 'some description in english')
  p.description # 'some description in english'

You can also use it more accessible.

  p.description :en # 'some description in english'

  p.set_description!(:short, :ru, 'some description in russian')
  p.set_description!(:long, :en, 'some long description in english')

  p.description :ru # 'some description in russian'
  p.description :long # 'some long description in english'

=== Other

Problems, comments, and suggestions all welcome. saksmlz@gmail.com

About

ActsAsDescribable plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages