Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Patricio Sanchez
/
quiniela-mundial
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Iker Narvaez
2018-06-08 17:05:13 -0500
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6812d2cd0f4b02e42ed45708695fe06c5c8550f7
6812d2cd
1 parent
d4fc057e
pg & heimdall setup
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
227 additions
and
8 deletions
Gemfile
Gemfile.lock
app/controllers/application_controller.rb
app/models/role.rb
app/models/user.rb
config/database.yml
config/routes.rb
db/migrate/20180608220336_create_heimdall_engine_roles.heimdall_engine.rb
db/migrate/20180608220337_create_heimdall_engine_role_abilities.heimdall_engine.rb
db/migrate/20180608220338_create_heimdall_responsabilities.heimdall_engine.rb
db/schema.rb
Gemfile
View file @
6812d2c
...
...
@@ -5,11 +5,16 @@ git_source(:github) do |repo_name|
"https://github.com/
#{
repo_name
}
.git"
end
gem
'crud_controller'
,
git:
'git@git.ukko.mx:ukko/crud_controller.git'
gem
'heimdall_engine'
,
git:
'git@git.ukko.mx:iker.n/heimdall-engine.git'
,
branch:
'rails_5_bootstrap_4'
gem
'paranoia'
gem
'paper_trail'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem
'rails'
,
'~> 5.0.6'
# Use sqlite3 as the database for Active Record
gem
'
sqlite3
'
gem
'
pg
'
# Use Puma as the app server
gem
'puma'
,
'~> 3.0'
# Use SCSS for stylesheets
...
...
Gemfile.lock
View file @
6812d2c
GIT
remote: git@git.ukko.mx:iker.n/heimdall-engine.git
revision: 23006b005c646fd304c1a3f9f509f9674d060ef5
branch: rails_5_bootstrap_4
specs:
heimdall_engine (5.1.6)
bcrypt
binding_of_caller
bootstrap-multiselect-rails
bootstrap-switch-rails
jquery-rails
jwt
paranoia
rails (>= 4.2.4)
rspec-rails
simple_form
slim
GIT
remote: git@git.ukko.mx:ukko/crud_controller.git
revision: 5452f4ed92d8974d165b932161a046eff25eebeb
specs:
crud_controller (0.3.0)
GEM
remote: https://rubygems.org/
specs:
...
...
@@ -39,7 +63,13 @@ GEM
minitest (~> 5.1)
tzinfo (~> 1.1)
arel (7.1.4)
bcrypt (3.1.12)
bindex (0.5.0)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
bootstrap-multiselect-rails (0.9.9)
rails (>= 4.0.0)
bootstrap-switch-rails (3.3.3)
builder (3.2.3)
byebug (10.0.2)
coffee-rails (4.2.2)
...
...
@@ -51,6 +81,8 @@ GEM
coffee-script-source (1.12.2)
concurrent-ruby (1.0.5)
crass (1.0.4)
debug_inspector (0.0.3)
diff-lcs (1.3)
erubis (2.7.0)
execjs (2.7.0)
ffi (1.9.25)
...
...
@@ -65,6 +97,7 @@ GEM
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jwt (2.1.0)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
...
...
@@ -81,6 +114,12 @@ GEM
nio4r (2.3.1)
nokogiri (1.8.2)
mini_portile2 (~> 2.3.0)
paper_trail (9.1.1)
activerecord (>= 4.2, < 5.3)
request_store (~> 1.1)
paranoia (2.4.1)
activerecord (>= 4.0, < 5.3)
pg (1.0.0)
puma (3.11.4)
rack (2.0.5)
rack-test (0.6.3)
...
...
@@ -112,6 +151,25 @@ GEM
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
request_store (1.4.1)
rack (>= 1.4)
rspec-core (3.7.1)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-mocks (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-rails (3.7.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-support (~> 3.7.0)
rspec-support (3.7.1)
sass (3.5.6)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
...
...
@@ -123,6 +181,12 @@ GEM
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
simple_form (4.0.1)
actionpack (>= 5.0)
activemodel (>= 5.0)
slim (3.0.9)
temple (>= 0.7.6, < 0.9)
tilt (>= 1.3.3, < 2.1)
spring (2.0.2)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
...
...
@@ -135,7 +199,7 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.13
)
temple (0.8.0
)
thor (0.20.0)
thread_safe (0.3.6)
tilt (2.0.8)
...
...
@@ -161,15 +225,19 @@ PLATFORMS
DEPENDENCIES
byebug
coffee-rails (~> 4.2)
crud_controller!
heimdall_engine!
jbuilder (~> 2.5)
jquery-rails
listen (~> 3.0.5)
paper_trail
paranoia
pg
puma (~> 3.0)
rails (~> 5.0.6)
sass-rails (~> 5.0)
spring
spring-watcher-listen (~> 2.0.0)
sqlite3
turbolinks (~> 5)
tzinfo-data
uglifier (>= 1.3.0)
...
...
app/controllers/application_controller.rb
View file @
6812d2c
class
ApplicationController
<
ActionController
::
Base
class
ApplicationController
<
HeimdallEngine
::
ApplicationController
protect_from_forgery
with: :exception
def
root
end
end
...
...
app/models/role.rb
0 → 100644
View file @
6812d2c
# frozen_string_literal: true
# == Schema Information
#
# Table name: heimdall_engine_roles
#
# id :integer not null, primary key
# name :string
# created_at :datetime
# updated_at :datetime
# deleted_at :datetime
# erasable :boolean
#
class
Role
<
HeimdallEngine
::
Role
acts_as_paranoid
has_paper_trail
end
app/models/user.rb
0 → 100644
View file @
6812d2c
# frozen_string_literal: true
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# deleted_at :datetime
# name :string
# mail :string
# password_hash :string
# password_salt :string
#
class
User
<
ApplicationRecord
acts_as_paranoid
has_paper_trail
acts_as_heimdall
attr_accessor
:current_password
validates
:name
,
:mail
,
presence:
true
validates
:password
,
presence:
true
,
on: :create
validates
:password
,
confirmation:
true
before_save
:encrypt_password
has_and_belongs_to_many
:roles
,
inverse_of: :users
,
class_name:
'HeimdallEngine::Role'
,
join_table:
'users_roles'
,
foreign_key:
"user_id"
,
association_foreign_key:
"role_id"
def
encrypt_password
return
unless
password
.
present?
self
.
password_salt
=
BCrypt
::
Engine
.
generate_salt
.
force_encoding
(
'UTF-8'
)
self
.
password_hash
=
BCrypt
::
Engine
.
hash_secret
(
password
,
password_salt
)
.
force_encoding
(
'UTF-8'
)
end
end
config/database.yml
View file @
6812d2c
...
...
@@ -5,21 +5,21 @@
# gem 'sqlite3'
#
default
:
&default
adapter
:
sqlite3
adapter
:
postgresql
pool
:
5
timeout
:
5000
development
:
<<
:
*default
database
:
db/development.sqlite3
database
:
quiniela_development
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test
:
<<
:
*default
database
:
db/test.sqlite3
database
:
quiniela_test
production
:
<<
:
*default
database
:
db/production.sqlite3
database
:
quiniela_production
...
...
config/routes.rb
View file @
6812d2c
Rails
.
application
.
routes
.
draw
do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
HeimdallEngine
.
load_routes
root
'application#root'
end
...
...
db/migrate/20180608220336_create_heimdall_engine_roles.heimdall_engine.rb
0 → 100644
View file @
6812d2c
# This migration comes from heimdall_engine (originally 20150410182436)
class
CreateHeimdallEngineRoles
<
ActiveRecord
::
Migration
[
5
.
0
]
def
change
create_table
:heimdall_engine_roles
do
|
t
|
t
.
string
:name
t
.
boolean
:erasable
,
default:
false
t
.
timestamps
t
.
datetime
:deleted_at
end
add_index
:heimdall_engine_roles
,
:deleted_at
end
end
db/migrate/20180608220337_create_heimdall_engine_role_abilities.heimdall_engine.rb
0 → 100644
View file @
6812d2c
# This migration comes from heimdall_engine (originally 20150413145047)
class
CreateHeimdallEngineRoleAbilities
<
ActiveRecord
::
Migration
[
5
.
0
]
def
change
create_table
:heimdall_engine_role_abilities
do
|
t
|
t
.
integer
:role_id
t
.
string
:key
t
.
timestamps
null:
false
end
add_index
:heimdall_engine_role_abilities
,
:key
add_index
:heimdall_engine_role_abilities
,
:role_id
end
end
db/migrate/20180608220338_create_heimdall_responsabilities.heimdall_engine.rb
0 → 100644
View file @
6812d2c
# This migration comes from heimdall_engine (originally 20150807194858)
class
CreateHeimdallResponsabilities
<
ActiveRecord
::
Migration
[
5
.
0
]
def
change
create_table
:users_roles
do
|
t
|
t
.
integer
HeimdallEngine
.
session_user_id
t
.
integer
:role_id
end
add_index
:users_roles
,
HeimdallEngine
.
session_user_id
add_index
:users_roles
,
:role_id
end
end
db/schema.rb
0 → 100644
View file @
6812d2c
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
20180608220338
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
create_table
"heimdall_engine_role_abilities"
,
force: :cascade
do
|
t
|
t
.
integer
"role_id"
t
.
string
"key"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
t
.
index
[
"key"
],
name:
"index_heimdall_engine_role_abilities_on_key"
,
using: :btree
t
.
index
[
"role_id"
],
name:
"index_heimdall_engine_role_abilities_on_role_id"
,
using: :btree
end
create_table
"heimdall_engine_roles"
,
force: :cascade
do
|
t
|
t
.
string
"name"
t
.
boolean
"erasable"
,
default:
false
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
t
.
datetime
"deleted_at"
t
.
index
[
"deleted_at"
],
name:
"index_heimdall_engine_roles_on_deleted_at"
,
using: :btree
end
create_table
"users_roles"
,
force: :cascade
do
|
t
|
t
.
integer
"user_id"
t
.
integer
"role_id"
t
.
index
[
"role_id"
],
name:
"index_users_roles_on_role_id"
,
using: :btree
t
.
index
[
"user_id"
],
name:
"index_users_roles_on_user_id"
,
using: :btree
end
end
Please
register
or
login
to post a comment