Project

page_parts

0.0
No commit activity in last 3 years
No release in over 3 years
Aimbulance CMS
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 3.0.0
 Project Readme

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