Biola Web Content Models Build Status

A set of shared Mongoid models for Biola's web content publishing platform.

Requirements

  • Ruby app (rails, sinatra, etc...)
  • Mongo
  • Elasticsearch
  • Roz server

Rails Setup

Add to Gemfile

gem 'buweb_content_models'

Run bundle install

Configuration

Create a new configuration file. These fields can be customized.

# /config/initializers/buweb_content_models.rb
BuwebContentModels.configure do |config|
  config.elasticsearch_index = 'directory'
  config.urn_namespaces = Settings.urn_namespaces
  config.roz_access_id = '***************'
  config.roz_secret_key = '***************'
end

Extending the included models

Add a new file such as /app/extensions/person.rb

Person.class_eval do
  has_one :user
  accepts_nested_attributes_for :social_media, reject_if: :all_blank, allow_destroy: true
end

Then load that file and any others in a new initializer /config/initializers/model_extensions.rb

Dir[Rails.root.join("app", "extensions", "*.rb")].each do |path|
  require path
end