Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Conflicts:
	lib/singleton-rails.rb
	singleton_rails.gemspec
  • Loading branch information
Raphael Vidal committed Jan 23, 2015
2 parents 79dc457 + 8c055cb commit d7b8da9
Show file tree
Hide file tree
Showing 47 changed files with 33 additions and 735 deletions.
14 changes: 2 additions & 12 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
source "https://rubygems.org"
source 'https://rubygems.org'

# Declare your gem's dependencies in singleton_rails.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
# For the actual gemspec see singleton_rails.gemspec
gemspec

# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.

# To use debugger
# gem 'debugger'
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# SingletonRails
# Singleton Rails

This project rocks and uses the MIT license.
[![Gem Version](https://img.shields.io/gem/v/singleton-rails.svg?style=flat)](https://rubygems.org/gems/singleton-rails)
[![Dependency Status](https://img.shields.io/gemnasium/hyperoslo/singleton-rails.svg?style=flat)](https://gemnasium.com/hyperoslo/singleton-rails)
[![Code Climate](https://img.shields.io/codeclimate/github/hyperoslo/singleton-rails.svg?style=flat)](https://codeclimate.com/github/hyperoslo/singleton-rails)

Adds singleton functionallity to ActiveRecord models.

**Supported Rails versions: 4.0.0 or higher**

Licensed under the **MIT** license, see LICENSE for more information.

## Installation

Expand All @@ -9,19 +17,21 @@ This project rocks and uses the MIT license.
## Usage

### Include Singleton in your model

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

### Configure rails_admin

```ruby
RailsAdmin.config do |config|

config.actions do
dashboard

index &RailsAdmin::Config::Actions::SingletonAwareIndex::PATCH
new
export
Expand All @@ -34,11 +44,12 @@ RailsAdmin.config do |config|
history_show
show_in_app
end

end
```

### How to use it in your controller

```ruby
class AboutPageController < ApplicationController
def index
Expand Down
4 changes: 0 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_files.include('lib/**/*.rb')
end




Bundler::GemHelper.install_tasks

require 'rake/testtask'
Expand All @@ -28,5 +25,4 @@ Rake::TestTask.new(:test) do |t|
t.verbose = false
end


task default: :test
8 changes: 4 additions & 4 deletions lib/singleton-rails.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require 'active_record' rescue nil

if defined? ActiveRecord
require "active_record/singleton"
require "rails_admin/config/actions/singleton_aware_delete"
require "rails_admin/config/actions/singleton_aware_index"
require "rails_admin/config/actions/singleton_aware_new"
require 'active_record/singleton'
require 'rails_admin/config/actions/singleton_aware_delete'
require 'rails_admin/config/actions/singleton_aware_index'
require 'rails_admin/config/actions/singleton_aware_new'
end
25 changes: 11 additions & 14 deletions singleton_rails.gemspec
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
$:.push File.expand_path("../lib", __FILE__)
$:.push File.expand_path('../lib', __FILE__)

# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "singleton-rails"
s.version = "0.0.2.1"
s.authors = ["Tim Kurvers", "Christoffer Winterkvist"]
s.email = ["[email protected]"]
s.homepage = "https://github.com/hyperoslo/singleton-rails"
s.summary = "Forever Alone Ruby Gem"
s.description = "Adds singleton functionallity to ActiveRecord models"
s.license = "MIT"
s.name = 'singleton-rails'
s.version = '0.0.2.1'
s.authors = ['Tim Kurvers', 'Christoffer Winterkvist']
s.email = ['[email protected]']
s.homepage = 'https://github.com/hyperoslo/singleton-rails'
s.summary = 'Adds singleton functionallity to ActiveRecord models'
s.description = 'Adds singleton functionallity to ActiveRecord models'
s.license = 'MIT'

s.files = Dir["{app,config,db,lib}/**/*", "LICENSE", "Rakefile"]
s.test_files = Dir["test/**/*"]
s.files = Dir['{app,config,db,lib}/**/*', 'LICENSE', 'Rakefile']

s.add_dependency "rails", '>= 4.0.6', '< 5.0.0'

s.add_development_dependency "sqlite3"
s.add_dependency 'rails', '>= 4.0.6', '< 5.0.0'
end
28 changes: 0 additions & 28 deletions test/dummy/README.rdoc

This file was deleted.

6 changes: 0 additions & 6 deletions test/dummy/Rakefile

This file was deleted.

Empty file removed test/dummy/app/assets/images/.keep
Empty file.
13 changes: 0 additions & 13 deletions test/dummy/app/assets/javascripts/application.js

This file was deleted.

15 changes: 0 additions & 15 deletions test/dummy/app/assets/stylesheets/application.css

This file was deleted.

5 changes: 0 additions & 5 deletions test/dummy/app/controllers/application_controller.rb

This file was deleted.

Empty file.
2 changes: 0 additions & 2 deletions test/dummy/app/helpers/application_helper.rb

This file was deleted.

Empty file removed test/dummy/app/mailers/.keep
Empty file.
Empty file removed test/dummy/app/models/.keep
Empty file.
Empty file.
14 changes: 0 additions & 14 deletions test/dummy/app/views/layouts/application.html.erb

This file was deleted.

3 changes: 0 additions & 3 deletions test/dummy/bin/bundle

This file was deleted.

4 changes: 0 additions & 4 deletions test/dummy/bin/rails

This file was deleted.

4 changes: 0 additions & 4 deletions test/dummy/bin/rake

This file was deleted.

4 changes: 0 additions & 4 deletions test/dummy/config.ru

This file was deleted.

23 changes: 0 additions & 23 deletions test/dummy/config/application.rb

This file was deleted.

5 changes: 0 additions & 5 deletions test/dummy/config/boot.rb

This file was deleted.

25 changes: 0 additions & 25 deletions test/dummy/config/database.yml

This file was deleted.

5 changes: 0 additions & 5 deletions test/dummy/config/environment.rb

This file was deleted.

29 changes: 0 additions & 29 deletions test/dummy/config/environments/development.rb

This file was deleted.

Loading

0 comments on commit d7b8da9

Please sign in to comment.