
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
activeadmin-mongoid-blog
Advanced tools
Blog app on the top of activeadmin and mongoid, using redactor and select2 plugins. Could be useful for almost every activeadmin based project.
IMPORTANT: Make sure local mongodb instance is running.
Replace new_blog name with the real one and run:
export project_name=new_blog ; curl https://raw.github.com/alexkravets/activeadmin-mongoid-blog/master/install.sh | sh
This command creates new rails project fully configured and ready for Heroku deploy.
$ rails new appname -T -O
Add these gems to Gemfile and run bundle command:
# Activeadmin
gem "bson_ext"
gem "mongoid"
gem "devise"
gem "activeadmin-mongoid"
# Activeadmin Mongoid Blog
gem "mongoid_slug"
gem "mongoid_search"
gem "nokogiri"
gem "select2-rails"
gem "redactor-rails", :git => "git://github.com/alexkravets/redactor-rails.git"
gem "carrierwave-mongoid", :require => "carrierwave/mongoid"
gem "mini_magick"
gem "activeadmin-mongoid-reorder"
gem "activeadmin-settings"
gem "activeadmin-mongoid-blog"
# Bootstrap styles
gem "therubyracer"
gem "twitter-bootstrap-rails"
# Assets
gem "aws-s3"
gem "fog"
gem "asset_sync"
Run following generators:
$ rails g mongoid:config
$ rails g devise:install
$ rails g active_admin:install
$ rails g redactor:install
$ rails g activeadmin_settings:install
$ rails g active_admin:blog:install blog
Create default admin user for activeadmin:
rake activeadmin:create_admin
Run rails s blog should be accesible at http://localhost:3000/blog
Install default views templates to /app/views/blog:
$ rails g active_admin:blog:views blog
By default blog is comming with a Twitter Bootstrap typography, to enable it add to Gemfile:
gem "twitter-bootstrap-rails", :git => "git://github.com/seyhunak/twitter-bootstrap-rails.git"
Install required bootstrap assets:
rails g bootstrap:install
Remove reuire_self line from application.js and application.css these are added by bootstrap intall and will break the layout with activeadmin styles.
In application.js include:
//= require bootstrap
In application.css include:
/*
    *= require bootstrap_and_overrides
    *= require_self
*/
// Tuning styles for kaminari pagination
.pagination .page.current {
  float:left;
  padding:0 14px;
  line-height:34px;
  text-decoration:none;
  border:1px solid #DDD;
  border-left-width:0;
  color:#999;
  cursor:default;
  background-color:whiteSmoke;
}
.pagination span:first-child, .pagination .first a { border-left-width:1px; }
Configure local and production config/mongoid.yml settings to look like this:
development:
  host: localhost
  database: supercaliblog
test:
  host: localhost
  database: supercaliblog_test
production:
  uri: <%= ENV["MONGO_URL"] %>
Create an S3 bucket for redactor image uploading feature and configure config/initializers/carrierwave.rb:
CarrierWave.configure do |config|
  config.cache_dir = File.join(Rails.root, "tmp", "uploads")
  config.storage = :fog
  config.fog_credentials = {
    :provider               => "AWS",
    :aws_access_key_id      => ENV["AWS_ACCESS_KEY_ID"],
    :aws_secret_access_key  => ENV["AWS_SECRET_ACCESS_KEY"]
  }
  case Rails.env.to_sym
    when :development
      config.storage = :file
    when :production
      config.fog_directory  = ENV["FOG_MEDIA_DIRECTORY"]
      config.fog_host       = "//#{ ENV["FOG_MEDIA_DIRECTORY"] }.s3.amazonaws.com"
      config.fog_attributes = {"Cache-Control"=>"max-age=315576000"}  # optional, defaults to {}
  end
end
Make sure you've set Heroku environtment variables:
FOG_MEDIA_DIRECTORY
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
MONGO_URL
Add the following line to config/environments/production.rb:
config.assets.precompile += ["active_admin.js", "active_admin.css", "redactor-rails/css/style.css"]
FAQs
Unknown package
We found that activeadmin-mongoid-blog demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.