Easy page contents
Ruby HTML JavaScript CSS
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
db/migrate
lib
test
.gitignore
.rubocop.yml
Gemfile
Gemfile.lock
MIT-LICENSE
README.md
Rakefile
page_parts.gemspec

README.md

PageParts

Build Status

Enable dynamic string attributes in your model

Install

gem 'page_parts'

ActiveRecord:

require 'page_parts/orm/active_record'
rake page_parts_engine:install:migrations

Mongoid:

require 'page_parts/orm/mongoid'

Usage

Setup fields at your model:

class Category < ActiveRecord::Base
  include PageParts::Extension

  page_parts :content, :sidebar
end

Use fields as normal attributes:

@category = Category.new
@category.content = "Some text"
@category.sidebar = "Sidebar text"
@category.save

Setup fields with suffixes:

page_parts :sidebar, suffix: [:en, :uk]

page_parts :content, suffix: I18n.available_locales

It generates attributes: sidebar_en, sidebar_uk

Tests

rake test

Copyright (c) 2012 Fodojo, released under the MIT license