Skip to content

afar/singleton-rails

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SingletonRails

This project rocks and uses the MIT license.

Installation

$ gem install singleton-rails

Usage

Include Singleton in your model

class AboutPage < ActiveRecord::Base
  include ActiveRecord::Singleton
end

Configure rails_admin

RailsAdmin.config do |config|
  
  config.actions do
    dashboard
 
    index &RailsAdmin::Config::Actions::SingletonAwareIndex::PATCH
    new
    export
    history_index
    bulk_delete

    show
    edit
    delete &RailsAdmin::Config::Actions::SingletonAwareDelete::PATCH
    history_show
    show_in_app
  end
  
end

How to use it in your controller

  class AboutPageController < ApplicationController
    def index
      @about_page = AboutPage.instance
    end
  end

Credits

Hyper made this. We're a digital communications agency with a passion for good code, and if you're using this library we probably want to hire you.

About

Forever Alone Ruby Gem

Resources

License

Stars

0 stars

Watchers

4 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Ruby 92.7%
  • CSS 3.9%
  • JavaScript 3.4%