Freeberry

Aimbulance Content Managment System For more instruction see Wiki.

Install

Dependents

In your Gemfile:

gem 'devise', '1.1.5'
gem 'paperclip', '2.3.8'
gem 'nokogiri', '1.4.4'
gem 'cancan', '1.5.1'
gem 'inherited_resources', '1.2.1'
gem 'haddock', '0.2.2'
gem "mime-types", '1.16', :require => 'mime/types'
gem "ckeditor", '3.5.0'

gem 'awesome_nested_set', :git => 'git://github.com/galetahub/awesome_nested_set.git'
gem 'will_paginate', :git => 'git://github.com/galetahub/will_paginate.git', :branch => 'rails3'
gem "freeberry", :git => "git://github.com/galetahub/freeberry.git"
gem 'cancan_namespace', :git => 'git://github.com/galetahub/cancan_namespace.git'
gem 'attach_file_field', :git => 'git://github.com/galetahub/attach_file_field.git'

Bundler

bundle install --path vendor/bundle

Plugins:

rails plugin install git://github.com/galetahub/enum_field.git
rails plugin install git://github.com/galetahub/salty_slugs.git
rails plugin install git://github.com/galetahub/auto_html.git

Generators

Plugin attach_file_field wants generate assets:

rails generate attach_file_field

Devise (github.com/plataformatec/devise)

rails generate devise:install

Ckeditor (github.com/galetahub/rails-ckeditor)

rails generate ckeditor:base
rails generate ckeditor:migration

Freeberry

rails generate freeberry:base
rails generate freeberry:models

Configuration

Create yml files:

cp config/application.yml.sample config/application.yml
cp config/database.yml.sample config/database.yml

Create database and load seed data:

rake db:create
rake db:migrate
rake db:seed

In config/application.rb:

config.autoload_paths += %W( #{config.root}/app/models/defaults )

Usage

MysqlUtils

* database_exists?
* truncate_table
* disable_keys
* enable_keys
* with_keys_disabled

Settingslogic

cass SystemSettings < Freeberry::Settingslogic
  source Rails.root.join("config", "application.yml")
end

Security

Freeberry by default protected all active record attributes for security with mass assignment. To access protected attributes to be dynamic based on user permissions:

# models/article.rb
class Article < ActiveRecord::Base
  attr_accessible :name, :content
end

# articles_controller.rb
def create
  @article = Article.new
  @article.accessible = :all if admin?
  @article.attributes = params[:article]
  if @article.save
    flash[:notice] = "Successfully created article."
    redirect_to @article
  else
    render :action => 'new'
  end
end

Generators

Manage scaffold:

rails generate freeberry:manage_scaffold ModelName

rails generate freeberry:manage_scaffold ModelName --parent=ParentModel

Example

Example goes here.

Copyright © 2010-2011 Aimbulance, released under the MIT license