initial copy commit
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::PostsController, type: :controller do
|
||||
describe "index" do
|
||||
describe 'unauthorized' do
|
||||
it 'redirects to login page' do
|
||||
get :index
|
||||
response.redirect_url.should end_with('/users/sign_in')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'authorized' do
|
||||
before { sign_in create :user }
|
||||
it "no default include, default pagination" do
|
||||
post1 = create :post, title: 'post-1', body: 'post-body-1'
|
||||
comment = create :comment, post: post1
|
||||
post2 = create :post, title: 'post-2', body: 'post-body-2'
|
||||
get :index
|
||||
assert_json(
|
||||
data: [
|
||||
{
|
||||
id: post1.id.to_s,
|
||||
type: "post",
|
||||
attributes: {"title"=>"post-1", "body"=>"post-body-1"},
|
||||
relationships: {
|
||||
comments: {data: [{id: comment.id.to_s , type: "comment" }]}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: post2.id.to_s,
|
||||
type: "post",
|
||||
attributes: {"title"=>"post-2", "body"=>"post-body-2"},
|
||||
relationships: {
|
||||
comments: {data: []}
|
||||
}
|
||||
},
|
||||
],
|
||||
meta: {"total-pages"=>1, "total-count"=>2}
|
||||
)
|
||||
end
|
||||
|
||||
it "does not paginate when index_pagination? is false" do
|
||||
expect( subject ).to receive(:index_pagination?).and_return false
|
||||
post1 = create :post, title: 'post-1', body: 'post-body-1'
|
||||
comment = create :comment, post: post1
|
||||
post2 = create :post, title: 'post-2', body: 'post-body-2'
|
||||
get :index
|
||||
assert_json(
|
||||
data: [
|
||||
{
|
||||
id: post1.id.to_s,
|
||||
type: "post",
|
||||
attributes: {"title"=>"post-1", "body"=>"post-body-1"},
|
||||
relationships: {
|
||||
comments: {data: [{id: comment.id.to_s , type: "comment" }]}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: post2.id.to_s,
|
||||
type: "post",
|
||||
attributes: {"title"=>"post-2", "body"=>"post-body-2"},
|
||||
relationships: {
|
||||
comments: {data: []}
|
||||
}
|
||||
},
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
it "includes associations if configured" do
|
||||
expect( subject ).to receive(:index_serialize_options).and_return(include: 'comments')
|
||||
post1 = create :post, title: 'post-1', body: 'post-body-1'
|
||||
comment = create :comment, post: post1, body: 'post-1-comment-1'
|
||||
post2 = create :post, title: 'post-2', body: 'post-body-2'
|
||||
get :index
|
||||
assert_json(
|
||||
data: [
|
||||
{
|
||||
id: post1.id.to_s,
|
||||
type: "post",
|
||||
attributes: {"title"=>"post-1", "body"=>"post-body-1"},
|
||||
relationships: {
|
||||
comments: {data: [{id: comment.id.to_s , type: "comment" }]}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: post2.id.to_s,
|
||||
type: "post",
|
||||
attributes: {"title"=>"post-2", "body"=>"post-body-2"},
|
||||
relationships: {
|
||||
comments: {data: []}
|
||||
}
|
||||
},
|
||||
],
|
||||
included: [
|
||||
{
|
||||
id: comment.id.to_s,
|
||||
type: "comment",
|
||||
attributes: {body: "post-1-comment-1"},
|
||||
relationships: {
|
||||
post: {data: {id: post1.id.to_s, type: "posts"}}
|
||||
}
|
||||
}
|
||||
],
|
||||
meta: {"total-pages"=>1, "total-count"=>2}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,42 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::PostsController, type: :controller do
|
||||
describe "update" do
|
||||
describe 'unauthorized' do
|
||||
it 'redirects to login page' do
|
||||
patch :update, params: {id: 9}
|
||||
response.redirect_url.should end_with('/users/sign_in')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'authorized' do
|
||||
before { sign_in create :user }
|
||||
it "includes associations if configured" do
|
||||
expect( subject ).to receive(:update_serialize_options).and_return(include: 'comments')
|
||||
post1 = create :post, title: 'post-1', body: 'post-body-1'
|
||||
comment = create :comment, post: post1, body: 'post-1-comment-1'
|
||||
patch :update, params: {id: post1.id, post: {title: 'post-1-updated', body: 'post-body-1-updated'}}
|
||||
assert_json(
|
||||
data: {
|
||||
id: post1.id.to_s,
|
||||
type: "post",
|
||||
attributes: {"title"=>"post-1", "body"=>"post-body-1-updated"}, # title not permitted, could be boolean admin
|
||||
relationships: {
|
||||
comments: {data: [{id: comment.id.to_s , type: "comment" }]}
|
||||
}
|
||||
},
|
||||
included: [
|
||||
{
|
||||
id: comment.id.to_s,
|
||||
type: "comment",
|
||||
attributes: {body: "post-1-comment-1"},
|
||||
relationships: {
|
||||
post: {data: {id: post1.id.to_s, type: "posts"}}
|
||||
}
|
||||
}
|
||||
]
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||
|
||||
require_relative 'config/application'
|
||||
|
||||
Rails.application.load_tasks
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
//= link_tree ../images
|
||||
//= link_directory ../javascripts .js
|
||||
//= link_directory ../stylesheets .css
|
||||
//= link dunlop_ember_manifest.js
|
||||
@@ -0,0 +1,13 @@
|
||||
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
||||
// listed below.
|
||||
//
|
||||
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
||||
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
||||
//
|
||||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
||||
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
||||
//
|
||||
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
||||
// about supported directives.
|
||||
//
|
||||
//= require_tree .
|
||||
@@ -0,0 +1,13 @@
|
||||
// Action Cable provides the framework to deal with WebSockets in Rails.
|
||||
// You can generate new channels where WebSocket features live using the rails generate channel command.
|
||||
//
|
||||
//= require action_cable
|
||||
//= require_self
|
||||
//= require_tree ./channels
|
||||
|
||||
(function() {
|
||||
this.App || (this.App = {});
|
||||
|
||||
App.cable = ActionCable.createConsumer();
|
||||
|
||||
}).call(this);
|
||||
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
||||
* listed below.
|
||||
*
|
||||
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
||||
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
||||
*
|
||||
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
||||
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
||||
* files in this directory. Styles in this file should be added after the last require_* statement.
|
||||
* It is generally better to create a new file per style scope.
|
||||
*
|
||||
*= require_tree .
|
||||
*= require_self
|
||||
*/
|
||||
@@ -0,0 +1,4 @@
|
||||
module ApplicationCable
|
||||
class Channel < ActionCable::Channel::Base
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
module ApplicationCable
|
||||
class Connection < ActionCable::Connection::Base
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
module Api
|
||||
class BaseController < ActionController::Base
|
||||
include Dunlop::Ember::ApiBaseController
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
module Api
|
||||
class PostsController < Api::BaseController
|
||||
def permitted_params
|
||||
[:body] # title not permitted
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,32 @@
|
||||
class ApplicationController < ActionController::Base
|
||||
# Prevent CSRF attacks by raising an exception.
|
||||
# For APIs, you may want to use :null_session instead.
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
before_action :authenticate_user!
|
||||
|
||||
#http://rails-bestpractices.com/posts/2010/08/23/fetch-current-user-in-models
|
||||
before_action :set_current_user
|
||||
|
||||
rescue_from CanCan::AccessDenied do
|
||||
render 'application/403', status: 403
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
def set_current_user
|
||||
request.env["exception_notifier.exception_data"] = {
|
||||
current_user: current_user.try(:inspect)
|
||||
}
|
||||
User.current = current_user
|
||||
end
|
||||
|
||||
# Return an array of ids given as a param or nil if nothing is supplied
|
||||
def ids_param
|
||||
return nil unless ids = params[:ids].presence
|
||||
@ids_param ||= (ids.is_a?(String) ? ids.split(RecordCollection.ids_separator) : Array.wrap(ids))
|
||||
end
|
||||
helper_method :ids_param
|
||||
|
||||
end
|
||||
@@ -0,0 +1,58 @@
|
||||
class CommentsController < ApplicationController
|
||||
before_action :set_comment, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /comments
|
||||
def index
|
||||
@comments = Comment.all
|
||||
end
|
||||
|
||||
# GET /comments/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /comments/new
|
||||
def new
|
||||
@comment = Comment.new
|
||||
end
|
||||
|
||||
# GET /comments/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /comments
|
||||
def create
|
||||
@comment = Comment.new(comment_params)
|
||||
|
||||
if @comment.save
|
||||
redirect_to @comment, notice: 'Comment was successfully created.'
|
||||
else
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /comments/1
|
||||
def update
|
||||
if @comment.update(comment_params)
|
||||
redirect_to @comment, notice: 'Comment was successfully updated.'
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /comments/1
|
||||
def destroy
|
||||
@comment.destroy
|
||||
redirect_to comments_url, notice: 'Comment was successfully destroyed.'
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_comment
|
||||
@comment = Comment.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
def comment_params
|
||||
params.require(:comment).permit(:user_id, :post_id, :body)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,58 @@
|
||||
class PostsController < ApplicationController
|
||||
before_action :set_post, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /posts
|
||||
def index
|
||||
@posts = Post.all
|
||||
end
|
||||
|
||||
# GET /posts/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /posts/new
|
||||
def new
|
||||
@post = Post.new
|
||||
end
|
||||
|
||||
# GET /posts/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /posts
|
||||
def create
|
||||
@post = Post.new(post_params)
|
||||
|
||||
if @post.save
|
||||
redirect_to @post, notice: 'Post was successfully created.'
|
||||
else
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /posts/1
|
||||
def update
|
||||
if @post.update(post_params)
|
||||
redirect_to @post, notice: 'Post was successfully updated.'
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /posts/1
|
||||
def destroy
|
||||
@post.destroy
|
||||
redirect_to posts_url, notice: 'Post was successfully destroyed.'
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_post
|
||||
@post = Post.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
def post_params
|
||||
params.require(:post).permit(:title, :body)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,2 @@
|
||||
module ApplicationHelper
|
||||
end
|
||||
@@ -0,0 +1,2 @@
|
||||
module CommentsHelper
|
||||
end
|
||||
@@ -0,0 +1,2 @@
|
||||
module PostsHelper
|
||||
end
|
||||
@@ -0,0 +1,2 @@
|
||||
class ApplicationJob < ActiveJob::Base
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
class ApplicationMailer < ActionMailer::Base
|
||||
default from: 'from@example.com'
|
||||
layout 'mailer'
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
class Ability
|
||||
include Dunlop::Ability
|
||||
|
||||
def setup_abilities
|
||||
setup_dunlop_abilities
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,18 @@
|
||||
class ApplicationRecord < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
self.inheritance_column = :sti_type
|
||||
|
||||
if Rails::VERSION::MAJOR < 5
|
||||
def saved_changes
|
||||
changes
|
||||
end
|
||||
end
|
||||
|
||||
class << self
|
||||
def truncate
|
||||
#connection_pool.with_connection { |c| c.truncate table_name }
|
||||
delete_all
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
class Comment < ApplicationRecord
|
||||
belongs_to :post
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
class ExecutionBatch < ApplicationRecord
|
||||
include Dunlop::ExecutionBatchModel
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
class Post < ApplicationRecord
|
||||
has_many :comments
|
||||
end
|
||||
@@ -0,0 +1,11 @@
|
||||
class User < ApplicationRecord
|
||||
include Dunlop::UserModel
|
||||
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable and :omniauthable
|
||||
devise :database_authenticatable, #:token_authenticatable, #:registerable,
|
||||
:recoverable, :rememberable, :trackable, :validatable
|
||||
|
||||
# To be overridden, with application logic
|
||||
scope :active, ->{ all }
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
class Api::CommentSerializer < ActiveModel::Serializer
|
||||
attribute :body
|
||||
belongs_to :post
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
class Api::PostSerializer < ActiveModel::Serializer
|
||||
attribute :title
|
||||
attribute :body
|
||||
has_many :comments
|
||||
end
|
||||
@@ -0,0 +1,18 @@
|
||||
= form_for @comment do |f|
|
||||
- if @comment.errors.any?
|
||||
#error_explanation
|
||||
h2 = "#{pluralize(@comment.errors.count, "error")} prohibited this comment from being saved:"
|
||||
ul
|
||||
- @comment.errors.full_messages.each do |message|
|
||||
li = message
|
||||
|
||||
.field
|
||||
= f.label :user_id
|
||||
= f.number_field :user_id
|
||||
.field
|
||||
= f.label :post_id
|
||||
= f.number_field :post_id
|
||||
.field
|
||||
= f.label :body
|
||||
= f.text_area :body
|
||||
.actions = f.submit
|
||||
@@ -0,0 +1,8 @@
|
||||
h1 Editing comment
|
||||
|
||||
== render 'form'
|
||||
|
||||
= link_to 'Show', @comment
|
||||
' |
|
||||
= link_to 'Back', comments_path
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
h1 Listing comments
|
||||
|
||||
table
|
||||
thead
|
||||
tr
|
||||
th User
|
||||
th Post
|
||||
th Body
|
||||
th
|
||||
th
|
||||
th
|
||||
|
||||
tbody
|
||||
- @comments.each do |comment|
|
||||
tr
|
||||
td = comment.user_id
|
||||
td = comment.post_id
|
||||
td = comment.body
|
||||
td = link_to 'Show', comment
|
||||
td = link_to 'Edit', edit_comment_path(comment)
|
||||
td = link_to 'Destroy', comment, data: { confirm: 'Are you sure?' }, method: :delete
|
||||
|
||||
br
|
||||
|
||||
= link_to 'New Comment', new_comment_path
|
||||
@@ -0,0 +1,5 @@
|
||||
h1 New comment
|
||||
|
||||
== render 'form'
|
||||
|
||||
= link_to 'Back', comments_path
|
||||
@@ -0,0 +1,15 @@
|
||||
p#notice = notice
|
||||
|
||||
p
|
||||
strong User:
|
||||
= @comment.user_id
|
||||
p
|
||||
strong Post:
|
||||
= @comment.post_id
|
||||
p
|
||||
strong Body:
|
||||
= @comment.body
|
||||
|
||||
= link_to 'Edit', edit_comment_path(@comment)
|
||||
' |
|
||||
= link_to 'Back', comments_path
|
||||
@@ -0,0 +1,5 @@
|
||||
- flash.each do |name, msg|
|
||||
- if msg.is_a?(String)
|
||||
div.alert-box.round class="#{name.to_s == 'notice' ? 'success' : 'alert'}" data-alert=""
|
||||
= content_tag :div, msg
|
||||
a.close href="#" ×
|
||||
@@ -0,0 +1,5 @@
|
||||
nav.top-bar data-topbar=true
|
||||
ul.title-area
|
||||
li.name= link_to application_name, main_app.root_path
|
||||
li.toggle-topbar.menu-icon: a href="#": span Menu
|
||||
.top-bar-section= render 'layouts/navigation_links'
|
||||
@@ -0,0 +1,39 @@
|
||||
- if signed_in?
|
||||
ul.right
|
||||
li class=active_class('dunlop#changelog')
|
||||
= link_to Rails.application.config.git_version, dunlop.changelog_path, title: 'Current version, click for changelog'
|
||||
li class=active_class('dunlop/users#profile', 'dunlop/users#edit_profile') = link_to current_user.email.to_s.sub(/\@.*/, ''), dunlop.profile_users_path
|
||||
li= link_to 'Sign out', main_app.destroy_user_session_path, method: :delete
|
||||
ul.left
|
||||
- if can? :index, WorkflowInstance
|
||||
li.has-dropdown class=active_class('workflow_instance')
|
||||
= link_to WorkflowInstance.model_name.human_plural, '#'
|
||||
ul.dropdown
|
||||
- WorkflowInstance.scenario_classes.each do |scenario|
|
||||
- if can? :read, scenario
|
||||
li class=active_class("workflow_instance/#{scenario.process_name.pluralize}") = link_to scenario.model_name.human_plural, [main_app, scenario]
|
||||
- if can? :index, WorkflowInstanceBatch
|
||||
li.has-dropdown class=active_class('workflow_instance_batch')
|
||||
= link_to WorkflowInstanceBatch.model_name.human_plural, '#'
|
||||
ul.dropdown
|
||||
- WorkflowInstance.scenario_classes.each do |scenario|
|
||||
- if can? :read, scenario.batch_class
|
||||
li class=active_class("workflow_instance_batch/#{scenario.batch_class.process_name.pluralize}") = link_to scenario.batch_class.model_name.human_plural, [main_app, scenario.batch_class]
|
||||
/- if can? :index, SourceFile or can? :index, TargetFile
|
||||
li.has-dropdown class=active_class('dunlop/source_files', 'dunlop/target_files')
|
||||
= link_to 'Files', '#'
|
||||
ul.dropdown
|
||||
- if can? :index, SourceFile
|
||||
li class=active_class('dunlop/source_files') = link_to SourceFile.model_name.human_plural, dunlop.source_files_path
|
||||
- if can? :index, TargetFile
|
||||
li class=active_class('dunlop/target_files') = link_to TargetFile.model_name.human_plural, dunlop.target_files_path
|
||||
- if can? :index, User
|
||||
li.has-dropdown class=active_class("dunlop/users", except: /profile$/)
|
||||
= link_to 'Admin', '#'
|
||||
ul.dropdown
|
||||
li class=active_class('dunlop/users', except: /profile$/) = link_to User.model_name.human_plural, dunlop.users_path
|
||||
/li{ class: active_class('manual') }= link_to 'Manual', manual_root_path
|
||||
- else
|
||||
ul.right
|
||||
li= link_to 'Sign In', main_app.new_user_session_path
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
doctype html
|
||||
html
|
||||
head
|
||||
meta name="viewport" content="width=device-width, initial-scale=1.0"
|
||||
title= content_for?(:title) ? yield(:title) : application_name
|
||||
meta name="description" content="#{content_for?(:description) ? yield(:description) : 'Migration Dashboard'}"
|
||||
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
|
||||
= javascript_include_tag 'vendor/modernizr'
|
||||
= javascript_include_tag 'application', 'data-turbolinks-track' => true
|
||||
= csrf_meta_tags
|
||||
body class=body_classes
|
||||
#workflow-step-modal.reveal-modal data-reveal=""
|
||||
.content
|
||||
a.close-reveal-modal ×
|
||||
header= render 'layouts/navigation'
|
||||
main role="main"
|
||||
.environment-ribbon class=Rails.env
|
||||
span= Rails.env
|
||||
= render 'layouts/messages'
|
||||
= yield
|
||||
footer
|
||||
.right
|
||||
Powered by
|
||||
= link_to 'FourStack B.V.', 'http://fourstack.nl/', target: :_blank
|
||||
#display-badge-info-popup.reveal-modal data-reveal=""
|
||||
.display-badge-info-content
|
||||
a.close-reveal-modal x
|
||||
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<style>
|
||||
/* Email styles need to be inline */
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<%= yield %>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
<%= yield %>
|
||||
@@ -0,0 +1,15 @@
|
||||
= form_for @post do |f|
|
||||
- if @post.errors.any?
|
||||
#error_explanation
|
||||
h2 = "#{pluralize(@post.errors.count, "error")} prohibited this post from being saved:"
|
||||
ul
|
||||
- @post.errors.full_messages.each do |message|
|
||||
li = message
|
||||
|
||||
.field
|
||||
= f.label :title
|
||||
= f.text_field :title
|
||||
.field
|
||||
= f.label :body
|
||||
= f.text_area :body
|
||||
.actions = f.submit
|
||||
@@ -0,0 +1,8 @@
|
||||
h1 Editing post
|
||||
|
||||
== render 'form'
|
||||
|
||||
= link_to 'Show', @post
|
||||
' |
|
||||
= link_to 'Back', posts_path
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
h1 Listing posts
|
||||
|
||||
table
|
||||
thead
|
||||
tr
|
||||
th Title
|
||||
th Body
|
||||
th
|
||||
th
|
||||
th
|
||||
|
||||
tbody
|
||||
- @posts.each do |post|
|
||||
tr
|
||||
td = post.title
|
||||
td = post.body
|
||||
td = link_to 'Show', post
|
||||
td = link_to 'Edit', edit_post_path(post)
|
||||
td = link_to 'Destroy', post, data: { confirm: 'Are you sure?' }, method: :delete
|
||||
|
||||
br
|
||||
|
||||
= link_to 'New Post', new_post_path
|
||||
@@ -0,0 +1,5 @@
|
||||
h1 New post
|
||||
|
||||
== render 'form'
|
||||
|
||||
= link_to 'Back', posts_path
|
||||
@@ -0,0 +1,12 @@
|
||||
p#notice = notice
|
||||
|
||||
p
|
||||
strong Title:
|
||||
= @post.title
|
||||
p
|
||||
strong Body:
|
||||
= @post.body
|
||||
|
||||
= link_to 'Edit', edit_post_path(@post)
|
||||
' |
|
||||
= link_to 'Back', posts_path
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env ruby
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||
load Gem.bin_path('bundler', 'bundle')
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env ruby
|
||||
APP_PATH = File.expand_path('../config/application', __dir__)
|
||||
require_relative '../config/boot'
|
||||
require 'rails/commands'
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env ruby
|
||||
require_relative '../config/boot'
|
||||
require 'rake'
|
||||
Rake.application.run
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env ruby
|
||||
require 'pathname'
|
||||
require 'fileutils'
|
||||
include FileUtils
|
||||
|
||||
# path to your application root.
|
||||
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
||||
|
||||
def system!(*args)
|
||||
system(*args) || abort("\n== Command #{args} failed ==")
|
||||
end
|
||||
|
||||
chdir APP_ROOT do
|
||||
# This script is a starting point to setup your application.
|
||||
# Add necessary setup steps to this file.
|
||||
|
||||
puts '== Installing dependencies =='
|
||||
system! 'gem install bundler --conservative'
|
||||
system('bundle check') || system!('bundle install')
|
||||
|
||||
# puts "\n== Copying sample files =="
|
||||
# unless File.exist?('config/database.yml')
|
||||
# cp 'config/database.yml.sample', 'config/database.yml'
|
||||
# end
|
||||
|
||||
puts "\n== Preparing database =="
|
||||
system! 'bin/rails db:setup'
|
||||
|
||||
puts "\n== Removing old logs and tempfiles =="
|
||||
system! 'bin/rails log:clear tmp:clear'
|
||||
|
||||
puts "\n== Restarting application server =="
|
||||
system! 'bin/rails restart'
|
||||
end
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env ruby
|
||||
require 'pathname'
|
||||
require 'fileutils'
|
||||
include FileUtils
|
||||
|
||||
# path to your application root.
|
||||
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
||||
|
||||
def system!(*args)
|
||||
system(*args) || abort("\n== Command #{args} failed ==")
|
||||
end
|
||||
|
||||
chdir APP_ROOT do
|
||||
# This script is a way to update your development environment automatically.
|
||||
# Add necessary update steps to this file.
|
||||
|
||||
puts '== Installing dependencies =='
|
||||
system! 'gem install bundler --conservative'
|
||||
system('bundle check') || system!('bundle install')
|
||||
|
||||
puts "\n== Updating database =="
|
||||
system! 'bin/rails db:migrate'
|
||||
|
||||
puts "\n== Removing old logs and tempfiles =="
|
||||
system! 'bin/rails log:clear tmp:clear'
|
||||
|
||||
puts "\n== Restarting application server =="
|
||||
system! 'bin/rails restart'
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
# This file is used by Rack-based servers to start the application.
|
||||
|
||||
require_relative 'config/environment'
|
||||
|
||||
run Rails.application
|
||||
@@ -0,0 +1,37 @@
|
||||
require_relative 'boot'
|
||||
|
||||
# Pick the frameworks you want:
|
||||
require "active_record/railtie"
|
||||
require "action_controller/railtie"
|
||||
require "action_view/railtie"
|
||||
require "action_mailer/railtie"
|
||||
require "active_job/railtie"
|
||||
require "action_cable/engine"
|
||||
# require "rails/test_unit/railtie"
|
||||
require "sprockets/railtie"
|
||||
|
||||
Bundler.require(*Rails.groups)
|
||||
require "dunlop/ember"
|
||||
|
||||
module Dummy
|
||||
class Application < Rails::Application
|
||||
|
||||
config.application_name = "Dummy"
|
||||
|
||||
config.git_version = Rails.env
|
||||
config.git_version = File.read('REVISION').strip if File.exists?('REVISION')
|
||||
config.git_version = File.read('OFFLINE_REVISION').strip if File.exists?('OFFLINE_REVISION')
|
||||
config.load_defaults 5.1
|
||||
|
||||
config.middleware.insert_before 0, Rack::Cors do
|
||||
allow do
|
||||
origins '*'
|
||||
resource '*', headers: :any, methods: [:get, :post, :options, :delete, :put, :patch]
|
||||
end
|
||||
end
|
||||
# Settings in config/environments/* take precedence over those specified here.
|
||||
# Application configuration should go into files in config/initializers
|
||||
# -- all .rb files in that directory are automatically loaded.
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
# Set up gems listed in the Gemfile.
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
|
||||
|
||||
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
||||
$LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
|
||||
@@ -0,0 +1,9 @@
|
||||
development:
|
||||
adapter: async
|
||||
|
||||
test:
|
||||
adapter: async
|
||||
|
||||
production:
|
||||
adapter: redis
|
||||
url: redis://localhost:6379/1
|
||||
@@ -0,0 +1,25 @@
|
||||
# SQLite version 3.x
|
||||
# gem install sqlite3
|
||||
#
|
||||
# Ensure the SQLite 3 gem is defined in your Gemfile
|
||||
# gem 'sqlite3'
|
||||
#
|
||||
default: &default
|
||||
adapter: sqlite3
|
||||
pool: 5
|
||||
timeout: 5000
|
||||
|
||||
development:
|
||||
<<: *default
|
||||
database: db/development.sqlite3
|
||||
|
||||
# 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
|
||||
|
||||
production:
|
||||
<<: *default
|
||||
database: db/production.sqlite3
|
||||
@@ -0,0 +1,5 @@
|
||||
# Load the Rails application.
|
||||
require_relative 'application'
|
||||
|
||||
# Initialize the Rails application.
|
||||
Rails.application.initialize!
|
||||
@@ -0,0 +1,58 @@
|
||||
Rails.application.configure do
|
||||
|
||||
config.time_zone = 'Moscow'
|
||||
config.git_version = 'develop'
|
||||
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
# In the development environment your application's code is reloaded on
|
||||
# every request. This slows down response time but is perfect for development
|
||||
# since you don't have to restart the web server when you make code changes.
|
||||
config.cache_classes = false
|
||||
|
||||
# Do not eager load code on boot.
|
||||
config.eager_load = false
|
||||
|
||||
# Show full error reports.
|
||||
config.consider_all_requests_local = true
|
||||
|
||||
# Enable/disable caching. By default caching is disabled.
|
||||
if Rails.root.join('tmp/caching-dev.txt').exist?
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
config.cache_store = :memory_store
|
||||
config.public_file_server.headers = {
|
||||
'Cache-Control' => 'public, max-age=172800'
|
||||
}
|
||||
else
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
config.cache_store = :null_store
|
||||
end
|
||||
|
||||
# Don't care if the mailer can't send.
|
||||
config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# Print deprecation notices to the Rails logger.
|
||||
config.active_support.deprecation = :log
|
||||
|
||||
# Raise an error on page load if there are pending migrations.
|
||||
config.active_record.migration_error = :page_load
|
||||
|
||||
# Debug mode disables concatenation and preprocessing of assets.
|
||||
# This option may cause significant delays in view rendering with a large
|
||||
# number of complex assets.
|
||||
config.assets.debug = true
|
||||
|
||||
# Suppress logger output for asset requests.
|
||||
config.assets.quiet = true
|
||||
|
||||
# Raises error for missing translations
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
|
||||
# Use an evented file watcher to asynchronously detect changes in source code,
|
||||
# routes, locales, etc. This feature depends on the listen gem.
|
||||
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
||||
end
|
||||
@@ -0,0 +1,86 @@
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
# Code is not reloaded between requests.
|
||||
config.cache_classes = true
|
||||
|
||||
# Eager load code on boot. This eager loads most of Rails and
|
||||
# your application in memory, allowing both threaded web servers
|
||||
# and those relying on copy on write to perform better.
|
||||
# Rake tasks automatically ignore this option for performance.
|
||||
config.eager_load = true
|
||||
|
||||
# Full error reports are disabled and caching is turned on.
|
||||
config.consider_all_requests_local = false
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
# Disable serving static files from the `/public` folder by default since
|
||||
# Apache or NGINX already handles this.
|
||||
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
||||
|
||||
# Compress JavaScripts and CSS.
|
||||
config.assets.js_compressor = :uglifier
|
||||
# config.assets.css_compressor = :sass
|
||||
|
||||
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
||||
config.assets.compile = false
|
||||
|
||||
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
||||
|
||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||
# config.action_controller.asset_host = 'http://assets.example.com'
|
||||
|
||||
# Specifies the header that your server uses for sending files.
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
||||
|
||||
# Mount Action Cable outside main process or domain
|
||||
# config.action_cable.mount_path = nil
|
||||
# config.action_cable.url = 'wss://example.com/cable'
|
||||
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
||||
|
||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||
# config.force_ssl = true
|
||||
|
||||
# Use the lowest log level to ensure availability of diagnostic information
|
||||
# when problems arise.
|
||||
config.log_level = :debug
|
||||
|
||||
# Prepend all log lines with the following tags.
|
||||
config.log_tags = [ :request_id ]
|
||||
|
||||
# Use a different cache store in production.
|
||||
# config.cache_store = :mem_cache_store
|
||||
|
||||
# Use a real queuing backend for Active Job (and separate queues per environment)
|
||||
# config.active_job.queue_adapter = :resque
|
||||
# config.active_job.queue_name_prefix = "dummy_#{Rails.env}"
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# Ignore bad email addresses and do not raise email delivery errors.
|
||||
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||
# config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||
# the I18n.default_locale when a translation cannot be found).
|
||||
config.i18n.fallbacks = true
|
||||
|
||||
# Send deprecation notices to registered listeners.
|
||||
config.active_support.deprecation = :notify
|
||||
|
||||
# Use default logging formatter so that PID and timestamp are not suppressed.
|
||||
config.log_formatter = ::Logger::Formatter.new
|
||||
|
||||
# Use a different logger for distributed setups.
|
||||
# require 'syslog/logger'
|
||||
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
||||
|
||||
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
||||
logger = ActiveSupport::Logger.new(STDOUT)
|
||||
logger.formatter = config.log_formatter
|
||||
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
||||
end
|
||||
|
||||
# Do not dump schema after migrations.
|
||||
config.active_record.dump_schema_after_migration = false
|
||||
end
|
||||
@@ -0,0 +1,46 @@
|
||||
Rails.application.configure do
|
||||
|
||||
config.time_zone = 'Moscow'
|
||||
config.git_version = 'test'
|
||||
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
# The test environment is used exclusively to run your application's
|
||||
# test suite. You never need to work with it otherwise. Remember that
|
||||
# your test database is "scratch space" for the test suite and is wiped
|
||||
# and recreated between test runs. Don't rely on the data there!
|
||||
config.cache_classes = true
|
||||
|
||||
# Do not eager load code on boot. This avoids loading your whole application
|
||||
# just for the purpose of running a single test. If you are using a tool that
|
||||
# preloads Rails for running tests, you may have to set it to true.
|
||||
config.eager_load = false
|
||||
|
||||
# Configure public file server for tests with Cache-Control for performance.
|
||||
config.public_file_server.enabled = true
|
||||
config.public_file_server.headers = {
|
||||
'Cache-Control' => 'public, max-age=3600'
|
||||
}
|
||||
|
||||
# Show full error reports and disable caching.
|
||||
config.consider_all_requests_local = true
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
# Raise exceptions instead of rendering exception templates.
|
||||
config.action_dispatch.show_exceptions = false
|
||||
|
||||
# Disable request forgery protection in test environment.
|
||||
config.action_controller.allow_forgery_protection = false
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# Tell Action Mailer not to deliver emails to the real world.
|
||||
# The :test delivery method accumulates sent emails in the
|
||||
# ActionMailer::Base.deliveries array.
|
||||
config.action_mailer.delivery_method = :test
|
||||
|
||||
# Print deprecation notices to the stderr.
|
||||
config.active_support.deprecation = :stderr
|
||||
|
||||
# Raises error for missing translations
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# ApplicationController.renderer.defaults.merge!(
|
||||
# http_host: 'example.org',
|
||||
# https: false
|
||||
# )
|
||||
@@ -0,0 +1,11 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Version of your assets, change this if you want to expire all your assets.
|
||||
Rails.application.config.assets.version = '1.0'
|
||||
|
||||
# Add additional assets to the asset load path
|
||||
# Rails.application.config.assets.paths << Emoji.images_path
|
||||
|
||||
# Precompile additional assets.
|
||||
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
||||
# Rails.application.config.assets.precompile += %w( search.js )
|
||||
@@ -0,0 +1,7 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
||||
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
||||
|
||||
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
||||
# Rails.backtrace_cleaner.remove_silencers!
|
||||
@@ -0,0 +1,5 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Specify a serializer for the signed and encrypted cookie jars.
|
||||
# Valid options are :json, :marshal, and :hybrid.
|
||||
Rails.application.config.action_dispatch.cookies_serializer = :json
|
||||
@@ -0,0 +1,277 @@
|
||||
# Use this hook to configure devise mailer, warden hooks and so forth.
|
||||
# Many of these configuration options can be set straight in your model.
|
||||
Devise.setup do |config|
|
||||
# The secret key used by Devise. Devise uses this key to generate
|
||||
# random tokens. Changing this key will render invalid all existing
|
||||
# confirmation, reset password and unlock tokens in the database.
|
||||
# Devise will use the `secret_key_base` as its `secret_key`
|
||||
# by default. You can change it below and use your own secret key.
|
||||
config.secret_key = '3538d800ea7a5fe1dba29d51c998fc44ee9728cb1d88ab536549e8a4d1ed224dc49ba6675d7a31e2fe3fe4fcd4ec677411c673ad862b2e853f1cf3ad0c31ee7f'
|
||||
|
||||
# ==> Mailer Configuration
|
||||
# Configure the e-mail address which will be shown in Devise::Mailer,
|
||||
# note that it will be overwritten if you use your own mailer class
|
||||
# with default "from" parameter.
|
||||
config.mailer_sender = 'dummy-test@example.com'
|
||||
|
||||
# Configure the class responsible to send e-mails.
|
||||
# config.mailer = 'Devise::Mailer'
|
||||
|
||||
# Configure the parent class responsible to send e-mails.
|
||||
# config.parent_mailer = 'ActionMailer::Base'
|
||||
|
||||
# ==> ORM configuration
|
||||
# Load and configure the ORM. Supports :active_record (default) and
|
||||
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
||||
# available as additional gems.
|
||||
require 'devise/orm/active_record'
|
||||
|
||||
# ==> Configuration for any authentication mechanism
|
||||
# Configure which keys are used when authenticating a user. The default is
|
||||
# just :email. You can configure it to use [:username, :subdomain], so for
|
||||
# authenticating a user, both parameters are required. Remember that those
|
||||
# parameters are used only when authenticating and not when retrieving from
|
||||
# session. If you need permissions, you should implement that in a before filter.
|
||||
# You can also supply a hash where the value is a boolean determining whether
|
||||
# or not authentication should be aborted when the value is not present.
|
||||
# config.authentication_keys = [:email]
|
||||
|
||||
# Configure parameters from the request object used for authentication. Each entry
|
||||
# given should be a request method and it will automatically be passed to the
|
||||
# find_for_authentication method and considered in your model lookup. For instance,
|
||||
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
||||
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
||||
# config.request_keys = []
|
||||
|
||||
# Configure which authentication keys should be case-insensitive.
|
||||
# These keys will be downcased upon creating or modifying a user and when used
|
||||
# to authenticate or find a user. Default is :email.
|
||||
config.case_insensitive_keys = [:email]
|
||||
|
||||
# Configure which authentication keys should have whitespace stripped.
|
||||
# These keys will have whitespace before and after removed upon creating or
|
||||
# modifying a user and when used to authenticate or find a user. Default is :email.
|
||||
config.strip_whitespace_keys = [:email]
|
||||
|
||||
# Tell if authentication through request.params is enabled. True by default.
|
||||
# It can be set to an array that will enable params authentication only for the
|
||||
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
||||
# enable it only for database (email + password) authentication.
|
||||
# config.params_authenticatable = true
|
||||
|
||||
# Tell if authentication through HTTP Auth is enabled. False by default.
|
||||
# It can be set to an array that will enable http authentication only for the
|
||||
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
||||
# enable it only for database authentication. The supported strategies are:
|
||||
# :database = Support basic authentication with authentication key + password
|
||||
# config.http_authenticatable = false
|
||||
|
||||
# If 401 status code should be returned for AJAX requests. True by default.
|
||||
# config.http_authenticatable_on_xhr = true
|
||||
|
||||
# The realm used in Http Basic Authentication. 'Application' by default.
|
||||
# config.http_authentication_realm = 'Application'
|
||||
|
||||
# It will change confirmation, password recovery and other workflows
|
||||
# to behave the same regardless if the e-mail provided was right or wrong.
|
||||
# Does not affect registerable.
|
||||
# config.paranoid = true
|
||||
|
||||
# By default Devise will store the user in session. You can skip storage for
|
||||
# particular strategies by setting this option.
|
||||
# Notice that if you are skipping storage for all authentication paths, you
|
||||
# may want to disable generating routes to Devise's sessions controller by
|
||||
# passing skip: :sessions to `devise_for` in your config/routes.rb
|
||||
config.skip_session_storage = [:http_auth]
|
||||
|
||||
# By default, Devise cleans up the CSRF token on authentication to
|
||||
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
||||
# requests for sign in and sign up, you need to get a new CSRF token
|
||||
# from the server. You can disable this option at your own risk.
|
||||
# config.clean_up_csrf_token_on_authentication = true
|
||||
|
||||
# When false, Devise will not attempt to reload routes on eager load.
|
||||
# This can reduce the time taken to boot the app but if your application
|
||||
# requires the Devise mappings to be loaded during boot time the application
|
||||
# won't boot properly.
|
||||
# config.reload_routes = true
|
||||
|
||||
# ==> Configuration for :database_authenticatable
|
||||
# For bcrypt, this is the cost for hashing the password and defaults to 11. If
|
||||
# using other algorithms, it sets how many times you want the password to be hashed.
|
||||
#
|
||||
# Limiting the stretches to just one in testing will increase the performance of
|
||||
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
||||
# a value less than 10 in other environments. Note that, for bcrypt (the default
|
||||
# algorithm), the cost increases exponentially with the number of stretches (e.g.
|
||||
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
|
||||
config.stretches = Rails.env.test? ? 1 : 11
|
||||
|
||||
# Set up a pepper to generate the hashed password.
|
||||
# config.pepper = '49df74b77985daa55af0cbbaa610e93dbffd32d2d3c211e9a2f46c8fc0b8555359077fce9803b8ed7e9dae4a7e5d6d728b94c23a0e2c654b29da2b1c901cff80'
|
||||
|
||||
# Send a notification to the original email when the user's email is changed.
|
||||
# config.send_email_changed_notification = false
|
||||
|
||||
# Send a notification email when the user's password is changed.
|
||||
# config.send_password_change_notification = false
|
||||
|
||||
# ==> Configuration for :confirmable
|
||||
# A period that the user is allowed to access the website even without
|
||||
# confirming their account. For instance, if set to 2.days, the user will be
|
||||
# able to access the website for two days without confirming their account,
|
||||
# access will be blocked just in the third day. Default is 0.days, meaning
|
||||
# the user cannot access the website without confirming their account.
|
||||
# config.allow_unconfirmed_access_for = 2.days
|
||||
|
||||
# A period that the user is allowed to confirm their account before their
|
||||
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
||||
# their account within 3 days after the mail was sent, but on the fourth day
|
||||
# their account can't be confirmed with the token any more.
|
||||
# Default is nil, meaning there is no restriction on how long a user can take
|
||||
# before confirming their account.
|
||||
# config.confirm_within = 3.days
|
||||
|
||||
# If true, requires any email changes to be confirmed (exactly the same way as
|
||||
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
||||
# db field (see migrations). Until confirmed, new email is stored in
|
||||
# unconfirmed_email column, and copied to email column on successful confirmation.
|
||||
config.reconfirmable = true
|
||||
|
||||
# Defines which key will be used when confirming an account
|
||||
# config.confirmation_keys = [:email]
|
||||
|
||||
# ==> Configuration for :rememberable
|
||||
# The time the user will be remembered without asking for credentials again.
|
||||
# config.remember_for = 2.weeks
|
||||
|
||||
# Invalidates all the remember me tokens when the user signs out.
|
||||
config.expire_all_remember_me_on_sign_out = true
|
||||
|
||||
# If true, extends the user's remember period when remembered via cookie.
|
||||
# config.extend_remember_period = false
|
||||
|
||||
# Options to be passed to the created cookie. For instance, you can set
|
||||
# secure: true in order to force SSL only cookies.
|
||||
# config.rememberable_options = {}
|
||||
|
||||
# ==> Configuration for :validatable
|
||||
# Range for password length.
|
||||
config.password_length = 6..128
|
||||
|
||||
# Email regex used to validate email formats. It simply asserts that
|
||||
# one (and only one) @ exists in the given string. This is mainly
|
||||
# to give user feedback and not to assert the e-mail validity.
|
||||
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
|
||||
|
||||
# ==> Configuration for :timeoutable
|
||||
# The time you want to timeout the user session without activity. After this
|
||||
# time the user will be asked for credentials again. Default is 30 minutes.
|
||||
# config.timeout_in = 30.minutes
|
||||
|
||||
# ==> Configuration for :lockable
|
||||
# Defines which strategy will be used to lock an account.
|
||||
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
||||
# :none = No lock strategy. You should handle locking by yourself.
|
||||
# config.lock_strategy = :failed_attempts
|
||||
|
||||
# Defines which key will be used when locking and unlocking an account
|
||||
# config.unlock_keys = [:email]
|
||||
|
||||
# Defines which strategy will be used to unlock an account.
|
||||
# :email = Sends an unlock link to the user email
|
||||
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
||||
# :both = Enables both strategies
|
||||
# :none = No unlock strategy. You should handle unlocking by yourself.
|
||||
# config.unlock_strategy = :both
|
||||
|
||||
# Number of authentication tries before locking an account if lock_strategy
|
||||
# is failed attempts.
|
||||
# config.maximum_attempts = 20
|
||||
|
||||
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
||||
# config.unlock_in = 1.hour
|
||||
|
||||
# Warn on the last attempt before the account is locked.
|
||||
# config.last_attempt_warning = true
|
||||
|
||||
# ==> Configuration for :recoverable
|
||||
#
|
||||
# Defines which key will be used when recovering the password for an account
|
||||
# config.reset_password_keys = [:email]
|
||||
|
||||
# Time interval you can reset your password with a reset password key.
|
||||
# Don't put a too small interval or your users won't have the time to
|
||||
# change their passwords.
|
||||
config.reset_password_within = 6.hours
|
||||
|
||||
# When set to false, does not sign a user in automatically after their password is
|
||||
# reset. Defaults to true, so a user is signed in automatically after a reset.
|
||||
# config.sign_in_after_reset_password = true
|
||||
|
||||
# ==> Configuration for :encryptable
|
||||
# Allow you to use another hashing or encryption algorithm besides bcrypt (default).
|
||||
# You can use :sha1, :sha512 or algorithms from others authentication tools as
|
||||
# :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
|
||||
# for default behavior) and :restful_authentication_sha1 (then you should set
|
||||
# stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
|
||||
#
|
||||
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
||||
# config.encryptor = :sha512
|
||||
|
||||
# ==> Scopes configuration
|
||||
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
||||
# "users/sessions/new". It's turned off by default because it's slower if you
|
||||
# are using only default views.
|
||||
# config.scoped_views = false
|
||||
|
||||
# Configure the default scope given to Warden. By default it's the first
|
||||
# devise role declared in your routes (usually :user).
|
||||
# config.default_scope = :user
|
||||
|
||||
# Set this configuration to false if you want /users/sign_out to sign out
|
||||
# only the current scope. By default, Devise signs out all scopes.
|
||||
# config.sign_out_all_scopes = true
|
||||
|
||||
# ==> Navigation configuration
|
||||
# Lists the formats that should be treated as navigational. Formats like
|
||||
# :html, should redirect to the sign in page when the user does not have
|
||||
# access, but formats like :xml or :json, should return 401.
|
||||
#
|
||||
# If you have any extra navigational formats, like :iphone or :mobile, you
|
||||
# should add them to the navigational formats lists.
|
||||
#
|
||||
# The "*/*" below is required to match Internet Explorer requests.
|
||||
# config.navigational_formats = ['*/*', :html]
|
||||
|
||||
# The default HTTP method used to sign out a resource. Default is :delete.
|
||||
config.sign_out_via = :delete
|
||||
|
||||
# ==> OmniAuth
|
||||
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
||||
# up on your models and hooks.
|
||||
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
||||
|
||||
# ==> Warden configuration
|
||||
# If you want to use other strategies, that are not supported by Devise, or
|
||||
# change the failure app, you can configure them inside the config.warden block.
|
||||
#
|
||||
# config.warden do |manager|
|
||||
# manager.intercept_401 = false
|
||||
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
||||
# end
|
||||
|
||||
# ==> Mountable engine configurations
|
||||
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
||||
# is mountable, there are some extra configurations to be taken into account.
|
||||
# The following options are available, assuming the engine is mounted as:
|
||||
#
|
||||
# mount MyEngine, at: '/my_engine'
|
||||
#
|
||||
# The router that invoked `devise_for`, in the example above, would be:
|
||||
# config.router_name = :my_engine
|
||||
#
|
||||
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
|
||||
# so you need to do it manually. For the users scope, it would be:
|
||||
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Configure sensitive parameters which will be filtered from the log file.
|
||||
Rails.application.config.filter_parameters += [:password]
|
||||
@@ -0,0 +1,16 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Add new inflection rules using the following format. Inflections
|
||||
# are locale specific, and you may define rules for as many different
|
||||
# locales as you wish. All of these examples are active by default:
|
||||
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||
# inflect.plural /^(ox)$/i, '\1en'
|
||||
# inflect.singular /^(ox)en/i, '\1'
|
||||
# inflect.irregular 'person', 'people'
|
||||
# inflect.uncountable %w( fish sheep )
|
||||
# end
|
||||
|
||||
# These inflection rules are supported but not enabled by default:
|
||||
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||
# inflect.acronym 'RESTful'
|
||||
# end
|
||||
@@ -0,0 +1,4 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Add new mime types for use in respond_to blocks:
|
||||
# Mime::Type.register "text/richtext", :rtf
|
||||
@@ -0,0 +1,24 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
#
|
||||
# This file contains migration options to ease your Rails 5.0 upgrade.
|
||||
#
|
||||
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
||||
|
||||
# Enable per-form CSRF tokens. Previous versions had false.
|
||||
Rails.application.config.action_controller.per_form_csrf_tokens = true
|
||||
|
||||
# Enable origin-checking CSRF mitigation. Previous versions had false.
|
||||
Rails.application.config.action_controller.forgery_protection_origin_check = true
|
||||
|
||||
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
|
||||
# Previous versions had false.
|
||||
ActiveSupport.to_time_preserves_timezone = true
|
||||
|
||||
# Require `belongs_to` associations by default. Previous versions had false.
|
||||
Rails.application.config.active_record.belongs_to_required_by_default = true
|
||||
|
||||
# Do not halt callback chains when a callback returns false. Previous versions had true.
|
||||
ActiveSupport.halt_callback_chains_on_return_false = false
|
||||
|
||||
# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
|
||||
Rails.application.config.ssl_options = { hsts: { subdomains: true } }
|
||||
@@ -0,0 +1,3 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
Rails.application.config.session_store :cookie_store, key: '_dummy_session'
|
||||
@@ -0,0 +1,14 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# This file contains settings for ActionController::ParamsWrapper which
|
||||
# is enabled by default.
|
||||
|
||||
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
||||
ActiveSupport.on_load(:action_controller) do
|
||||
wrap_parameters format: [:json]
|
||||
end
|
||||
|
||||
# To enable root element in JSON for ActiveRecord objects.
|
||||
# ActiveSupport.on_load(:active_record) do
|
||||
# self.include_root_in_json = true
|
||||
# end
|
||||
@@ -0,0 +1,64 @@
|
||||
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
|
||||
|
||||
en:
|
||||
devise:
|
||||
confirmations:
|
||||
confirmed: "Your email address has been successfully confirmed."
|
||||
send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
|
||||
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
|
||||
failure:
|
||||
already_authenticated: "You are already signed in."
|
||||
inactive: "Your account is not activated yet."
|
||||
invalid: "Invalid %{authentication_keys} or password."
|
||||
locked: "Your account is locked."
|
||||
last_attempt: "You have one more attempt before your account is locked."
|
||||
not_found_in_database: "Invalid %{authentication_keys} or password."
|
||||
timeout: "Your session expired. Please sign in again to continue."
|
||||
unauthenticated: "You need to sign in or sign up before continuing."
|
||||
unconfirmed: "You have to confirm your email address before continuing."
|
||||
mailer:
|
||||
confirmation_instructions:
|
||||
subject: "Confirmation instructions"
|
||||
reset_password_instructions:
|
||||
subject: "Reset password instructions"
|
||||
unlock_instructions:
|
||||
subject: "Unlock instructions"
|
||||
email_changed:
|
||||
subject: "Email Changed"
|
||||
password_change:
|
||||
subject: "Password Changed"
|
||||
omniauth_callbacks:
|
||||
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
|
||||
success: "Successfully authenticated from %{kind} account."
|
||||
passwords:
|
||||
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
|
||||
send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
|
||||
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
|
||||
updated: "Your password has been changed successfully. You are now signed in."
|
||||
updated_not_active: "Your password has been changed successfully."
|
||||
registrations:
|
||||
destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
|
||||
signed_up: "Welcome! You have signed up successfully."
|
||||
signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
|
||||
signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
|
||||
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
|
||||
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
|
||||
updated: "Your account has been updated successfully."
|
||||
sessions:
|
||||
signed_in: "Signed in successfully."
|
||||
signed_out: "Signed out successfully."
|
||||
already_signed_out: "Signed out successfully."
|
||||
unlocks:
|
||||
send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
|
||||
send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
|
||||
unlocked: "Your account has been unlocked successfully. Please sign in to continue."
|
||||
errors:
|
||||
messages:
|
||||
already_confirmed: "was already confirmed, please try signing in"
|
||||
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
|
||||
expired: "has expired, please request a new one"
|
||||
not_found: "not found"
|
||||
not_locked: "was not locked"
|
||||
not_saved:
|
||||
one: "1 error prohibited this %{resource} from being saved:"
|
||||
other: "%{count} errors prohibited this %{resource} from being saved:"
|
||||
@@ -0,0 +1,23 @@
|
||||
# Files in the config/locales directory are used for internationalization
|
||||
# and are automatically loaded by Rails. If you want to use locales other
|
||||
# than English, add the necessary files in this directory.
|
||||
#
|
||||
# To use the locales, use `I18n.t`:
|
||||
#
|
||||
# I18n.t 'hello'
|
||||
#
|
||||
# In views, this is aliased to just `t`:
|
||||
#
|
||||
# <%= t('hello') %>
|
||||
#
|
||||
# To use a different locale, set it with `I18n.locale`:
|
||||
#
|
||||
# I18n.locale = :es
|
||||
#
|
||||
# This would use the information in config/locales/es.yml.
|
||||
#
|
||||
# To learn more, please read the Rails Internationalization guide
|
||||
# available at http://guides.rubyonrails.org/i18n.html.
|
||||
|
||||
en:
|
||||
hello: "Hello world"
|
||||
@@ -0,0 +1,47 @@
|
||||
# Puma can serve each request in a thread from an internal thread pool.
|
||||
# The `threads` method setting takes two numbers a minimum and maximum.
|
||||
# Any libraries that use thread pools should be configured to match
|
||||
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
||||
# and maximum, this matches the default thread size of Active Record.
|
||||
#
|
||||
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
|
||||
threads threads_count, threads_count
|
||||
|
||||
# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
|
||||
#
|
||||
port ENV.fetch("PORT") { 3000 }
|
||||
|
||||
# Specifies the `environment` that Puma will run in.
|
||||
#
|
||||
environment ENV.fetch("RAILS_ENV") { "development" }
|
||||
|
||||
# Specifies the number of `workers` to boot in clustered mode.
|
||||
# Workers are forked webserver processes. If using threads and workers together
|
||||
# the concurrency of the application would be max `threads` * `workers`.
|
||||
# Workers do not work on JRuby or Windows (both of which do not support
|
||||
# processes).
|
||||
#
|
||||
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
|
||||
|
||||
# Use the `preload_app!` method when specifying a `workers` number.
|
||||
# This directive tells Puma to first boot the application and load code
|
||||
# before forking the application. This takes advantage of Copy On Write
|
||||
# process behavior so workers use less memory. If you use this option
|
||||
# you need to make sure to reconnect any threads in the `on_worker_boot`
|
||||
# block.
|
||||
#
|
||||
# preload_app!
|
||||
|
||||
# The code in the `on_worker_boot` will be called if you are using
|
||||
# clustered mode by specifying a number of `workers`. After each worker
|
||||
# process is booted this block will be run, if you are using `preload_app!`
|
||||
# option you will want to use this block to reconnect to any threads
|
||||
# or connections that may have been created at application boot, Ruby
|
||||
# cannot share connections between processes.
|
||||
#
|
||||
# on_worker_boot do
|
||||
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
||||
# end
|
||||
|
||||
# Allow puma to be restarted by `rails restart` command.
|
||||
plugin :tmp_restart
|
||||
@@ -0,0 +1,11 @@
|
||||
Rails.application.routes.draw do
|
||||
mount Dunlop::Engine => "/dunlop"
|
||||
resources :comments
|
||||
resources :posts
|
||||
devise_for :users
|
||||
mount Dunlop::Ember::Engine => "/app", as: :app
|
||||
namespace :api do
|
||||
resources :comments
|
||||
resources :posts
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,22 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Your secret key is used for verifying the integrity of signed cookies.
|
||||
# If you change this key, all old signed cookies will become invalid!
|
||||
|
||||
# Make sure the secret is at least 30 characters and all random,
|
||||
# no regular words or you'll be exposed to dictionary attacks.
|
||||
# You can use `rails secret` to generate a secure secret key.
|
||||
|
||||
# Make sure the secrets in this file are kept private
|
||||
# if you're sharing your code publicly.
|
||||
|
||||
development:
|
||||
secret_key_base: 0c559e89f99778575a9fac1cb44f0aefedeac486b1c7c1614a9f5c1467acca856b7bae0ca89b1c6975f81857619dcdd04f2947e0b07a759f67503450f46046da
|
||||
|
||||
test:
|
||||
secret_key_base: 6ea9df1b658a31fd40e3caf40733753351964092ceddcb573c7515a33606c8d795166fa3c4df1bf89eb74a8383ad9eb6278498719b8806ab72e9816ca69f0dc3
|
||||
|
||||
# Do not keep production secrets in the repository,
|
||||
# instead read values from the environment.
|
||||
production:
|
||||
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
||||
@@ -0,0 +1,6 @@
|
||||
%w(
|
||||
.ruby-version
|
||||
.rbenv-vars
|
||||
tmp/restart.txt
|
||||
tmp/caching-dev.txt
|
||||
).each { |path| Spring.watch(path) }
|
||||
@@ -0,0 +1,10 @@
|
||||
class CreatePosts < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :posts do |t|
|
||||
t.string :title
|
||||
t.text :body
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,11 @@
|
||||
class CreateComments < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :comments do |t|
|
||||
t.integer :user_id
|
||||
t.integer :post_id
|
||||
t.text :body
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,42 @@
|
||||
class DeviseCreateUsers < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :users do |t|
|
||||
## Database authenticatable
|
||||
t.string :email, null: false, default: ""
|
||||
t.string :encrypted_password, null: false, default: ""
|
||||
|
||||
## Recoverable
|
||||
t.string :reset_password_token
|
||||
t.datetime :reset_password_sent_at
|
||||
|
||||
## Rememberable
|
||||
t.datetime :remember_created_at
|
||||
|
||||
## Trackable
|
||||
t.integer :sign_in_count, default: 0, null: false
|
||||
t.datetime :current_sign_in_at
|
||||
t.datetime :last_sign_in_at
|
||||
t.string :current_sign_in_ip
|
||||
t.string :last_sign_in_ip
|
||||
|
||||
## Confirmable
|
||||
# t.string :confirmation_token
|
||||
# t.datetime :confirmed_at
|
||||
# t.datetime :confirmation_sent_at
|
||||
# t.string :unconfirmed_email # Only if using reconfirmable
|
||||
|
||||
## Lockable
|
||||
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
||||
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
||||
# t.datetime :locked_at
|
||||
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :users, :email, unique: true
|
||||
add_index :users, :reset_password_token, unique: true
|
||||
# add_index :users, :confirmation_token, unique: true
|
||||
# add_index :users, :unlock_token, unique: true
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class AddAdminAndRoleNamesToUsers < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
add_column :users, :admin, :boolean, default: false, null: false
|
||||
add_column :users, :role_names, :text
|
||||
add_column :users, :role_names_admin, :text
|
||||
add_column :users, :settings_storage, :text
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
# 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: 20170926050413) do
|
||||
|
||||
create_table "comments", force: :cascade do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "post_id"
|
||||
t.text "body"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "posts", force: :cascade do |t|
|
||||
t.string "title"
|
||||
t.text "body"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "users", force: :cascade do |t|
|
||||
t.string "email", default: "", null: false
|
||||
t.string "encrypted_password", default: "", null: false
|
||||
t.string "reset_password_token"
|
||||
t.datetime "reset_password_sent_at"
|
||||
t.datetime "remember_created_at"
|
||||
t.integer "sign_in_count", default: 0, null: false
|
||||
t.datetime "current_sign_in_at"
|
||||
t.datetime "last_sign_in_at"
|
||||
t.string "current_sign_in_ip"
|
||||
t.string "last_sign_in_ip"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.boolean "admin", default: false, null: false
|
||||
t.text "role_names"
|
||||
t.text "role_names_admin"
|
||||
t.text "settings_storage"
|
||||
t.index ["email"], name: "index_users_on_email", unique: true
|
||||
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,67 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>The page you were looking for doesn't exist (404)</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<style>
|
||||
body {
|
||||
background-color: #EFEFEF;
|
||||
color: #2E2F30;
|
||||
text-align: center;
|
||||
font-family: arial, sans-serif;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div.dialog {
|
||||
width: 95%;
|
||||
max-width: 33em;
|
||||
margin: 4em auto 0;
|
||||
}
|
||||
|
||||
div.dialog > div {
|
||||
border: 1px solid #CCC;
|
||||
border-right-color: #999;
|
||||
border-left-color: #999;
|
||||
border-bottom-color: #BBB;
|
||||
border-top: #B00100 solid 4px;
|
||||
border-top-left-radius: 9px;
|
||||
border-top-right-radius: 9px;
|
||||
background-color: white;
|
||||
padding: 7px 12% 0;
|
||||
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 100%;
|
||||
color: #730E15;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
div.dialog > p {
|
||||
margin: 0 0 1em;
|
||||
padding: 1em;
|
||||
background-color: #F7F7F7;
|
||||
border: 1px solid #CCC;
|
||||
border-right-color: #999;
|
||||
border-left-color: #999;
|
||||
border-bottom-color: #999;
|
||||
border-bottom-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-top-color: #DADADA;
|
||||
color: #666;
|
||||
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- This file lives in public/404.html -->
|
||||
<div class="dialog">
|
||||
<div>
|
||||
<h1>The page you were looking for doesn't exist.</h1>
|
||||
<p>You may have mistyped the address or the page may have moved.</p>
|
||||
</div>
|
||||
<p>If you are the application owner check the logs for more information.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,67 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>The change you wanted was rejected (422)</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<style>
|
||||
body {
|
||||
background-color: #EFEFEF;
|
||||
color: #2E2F30;
|
||||
text-align: center;
|
||||
font-family: arial, sans-serif;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div.dialog {
|
||||
width: 95%;
|
||||
max-width: 33em;
|
||||
margin: 4em auto 0;
|
||||
}
|
||||
|
||||
div.dialog > div {
|
||||
border: 1px solid #CCC;
|
||||
border-right-color: #999;
|
||||
border-left-color: #999;
|
||||
border-bottom-color: #BBB;
|
||||
border-top: #B00100 solid 4px;
|
||||
border-top-left-radius: 9px;
|
||||
border-top-right-radius: 9px;
|
||||
background-color: white;
|
||||
padding: 7px 12% 0;
|
||||
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 100%;
|
||||
color: #730E15;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
div.dialog > p {
|
||||
margin: 0 0 1em;
|
||||
padding: 1em;
|
||||
background-color: #F7F7F7;
|
||||
border: 1px solid #CCC;
|
||||
border-right-color: #999;
|
||||
border-left-color: #999;
|
||||
border-bottom-color: #999;
|
||||
border-bottom-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-top-color: #DADADA;
|
||||
color: #666;
|
||||
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- This file lives in public/422.html -->
|
||||
<div class="dialog">
|
||||
<div>
|
||||
<h1>The change you wanted was rejected.</h1>
|
||||
<p>Maybe you tried to change something you didn't have access to.</p>
|
||||
</div>
|
||||
<p>If you are the application owner check the logs for more information.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,66 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>We're sorry, but something went wrong (500)</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<style>
|
||||
body {
|
||||
background-color: #EFEFEF;
|
||||
color: #2E2F30;
|
||||
text-align: center;
|
||||
font-family: arial, sans-serif;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div.dialog {
|
||||
width: 95%;
|
||||
max-width: 33em;
|
||||
margin: 4em auto 0;
|
||||
}
|
||||
|
||||
div.dialog > div {
|
||||
border: 1px solid #CCC;
|
||||
border-right-color: #999;
|
||||
border-left-color: #999;
|
||||
border-bottom-color: #BBB;
|
||||
border-top: #B00100 solid 4px;
|
||||
border-top-left-radius: 9px;
|
||||
border-top-right-radius: 9px;
|
||||
background-color: white;
|
||||
padding: 7px 12% 0;
|
||||
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 100%;
|
||||
color: #730E15;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
div.dialog > p {
|
||||
margin: 0 0 1em;
|
||||
padding: 1em;
|
||||
background-color: #F7F7F7;
|
||||
border: 1px solid #CCC;
|
||||
border-right-color: #999;
|
||||
border-left-color: #999;
|
||||
border-bottom-color: #999;
|
||||
border-bottom-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-top-color: #DADADA;
|
||||
color: #666;
|
||||
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- This file lives in public/500.html -->
|
||||
<div class="dialog">
|
||||
<div>
|
||||
<h1>We're sorry, but something went wrong.</h1>
|
||||
</div>
|
||||
<p>If you are the application owner check the logs for more information.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,7 @@
|
||||
FactoryGirl.define do
|
||||
factory :comment do
|
||||
user_id 1
|
||||
post_id 1
|
||||
body "MyText"
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
FactoryGirl.define do
|
||||
factory :post do
|
||||
sequence(:title) {|i| "post-#{i}"}
|
||||
sequence(:body) {|i| "post-body-#{i}"}
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
FactoryGirl.define do
|
||||
factory :user do
|
||||
sequence(:email) { |i| "user#{i}@example.com" }
|
||||
password 'secret'
|
||||
end
|
||||
factory :admin, parent: :user do
|
||||
admin true
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,62 @@
|
||||
# root application situation
|
||||
class Test1
|
||||
end
|
||||
module Api
|
||||
class Test1sController < ApplicationController
|
||||
include Dunlop::Ember::ApiBaseController
|
||||
end
|
||||
end
|
||||
|
||||
# namespaced engine situation
|
||||
module Adapter1
|
||||
class Test2
|
||||
end
|
||||
module Api
|
||||
class Test2sController < ApplicationController
|
||||
include Dunlop::Ember::ApiBaseController
|
||||
end
|
||||
class RootFallBackModelsController < ApplicationController
|
||||
include Dunlop::Ember::ApiBaseController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class RootFallBackModel
|
||||
# Root model, requested by namespaced controller
|
||||
end
|
||||
|
||||
describe Dunlop::Ember::ApiBaseController do
|
||||
describe '#record_class private method, but for now because of unit control' do
|
||||
it "finds the proper class on Api:: namespace" do
|
||||
Api::Test1sController.new.record_class.should eq Test1
|
||||
end
|
||||
|
||||
it "finds the proper class on Adapter::Api:: namespace" do
|
||||
Adapter1::Api::Test2sController.new.record_class.should eq Adapter1::Test2
|
||||
end
|
||||
|
||||
it 'falls back to demodularized version if namespaced version is not found' do
|
||||
controller = Adapter1::Api::RootFallBackModelsController.new
|
||||
controller.record_class.should eq RootFallBackModel
|
||||
end
|
||||
end
|
||||
|
||||
describe '#record_params' do
|
||||
it "finds the proper class on Api:: namespace" do
|
||||
controller = Api::Test1sController.new
|
||||
expect(controller).to receive(:params).and_return ActionController::Parameters.new(test1: {a: 1, b: 2})
|
||||
expect(controller).to receive(:permitted_params).and_return [:a]
|
||||
controller.__send__(:record_params).to_hash.should eq('a' => 1)
|
||||
end
|
||||
|
||||
it "finds the proper class on Adapter::Api:: namespace" do
|
||||
controller = Adapter1::Api::Test2sController.new
|
||||
expect(controller).to receive(:params).and_return ActionController::Parameters.new('adapter1/test2' => {a: 1, b: 2})
|
||||
expect(controller).to receive(:permitted_params).and_return [:b]
|
||||
controller.__send__(:record_params).to_hash.should eq('b' => 2)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
||||
require 'spec_helper'
|
||||
ENV['RAILS_ENV'] ||= 'test'
|
||||
test_log = File.expand_path('../dummy/log/test.log', __FILE__)
|
||||
File.delete(test_log) if File.exist?(test_log)
|
||||
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
||||
|
||||
# Prevent database truncation if the environment is production
|
||||
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
||||
require 'rspec/rails'
|
||||
require 'pry'
|
||||
require 'rspec/rails'
|
||||
require 'devise'
|
||||
require 'rspec/dunlop'
|
||||
#require 'capybara/poltergeist'
|
||||
|
||||
ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
|
||||
# Requires supporting ruby files with custom matchers and macros, etc,
|
||||
# in spec/support/ and its subdirectories.
|
||||
Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb")].each {|f| require f }
|
||||
Dir[File.join(ENGINE_RAILS_ROOT, "spec/factories/**/*.rb")].each {|f| require f }
|
||||
#FactoryGirl.definition_file_paths = [File.join(ENGINE_RAILS_ROOT, "spec/factories/**/*.rb")] # not needed here
|
||||
Dir.glob("spec/acceptance/steps/**/*steps.rb") { |f| load f, true }
|
||||
|
||||
# Add additional requires below this line. Rails is not loaded until this point!
|
||||
|
||||
# Requires supporting ruby files with custom matchers and macros, etc, in
|
||||
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
||||
# run as spec files by default. This means that files in spec/support that end
|
||||
# in _spec.rb will both be required and run as specs, causing the specs to be
|
||||
# run twice. It is recommended that you do not name files matching this glob to
|
||||
# end with _spec.rb. You can configure this pattern with the --pattern
|
||||
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
||||
#
|
||||
# The following line is provided for convenience purposes. It has the downside
|
||||
# of increasing the boot-up time by auto-requiring all files in the support
|
||||
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
||||
# require only the support files necessary.
|
||||
#
|
||||
# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
||||
|
||||
# Checks for pending migration and applies them before tests are run.
|
||||
# If you are not using ActiveRecord, you can remove this line.
|
||||
ActiveRecord::Migration.maintain_test_schema!
|
||||
module ControllerJuice
|
||||
def assert_json(obj)
|
||||
response.body.should eq obj.to_json
|
||||
end
|
||||
end
|
||||
DatabaseCleaner.strategy = :truncation
|
||||
RSpec::Support::ObjectFormatter.default_instance.max_formatted_output_length = 10_000 # do not trash string like: expected: "abc .... def"
|
||||
RSpec.configure do |config|
|
||||
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
||||
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
||||
config.expect_with(:rspec) { |c| c.syntax = [:should, :expect] }
|
||||
config.include FactoryGirl::Syntax::Methods
|
||||
config.include Rspec::Dunlop::GeneralHelpers
|
||||
config.include Rspec::Dunlop::FeatureHelpers, type: :feature
|
||||
config.include Devise::Test::ControllerHelpers, type: :controller
|
||||
config.include ControllerJuice, type: :controller
|
||||
|
||||
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
||||
# examples within a transaction, remove the following line or assign false
|
||||
# instead of true.
|
||||
config.use_transactional_fixtures = false
|
||||
config.before :suite do
|
||||
#FactoryGirl.reload # to add the adapter factories
|
||||
#DatabaseCleaner.clean_with(:truncation)
|
||||
DatabaseCleaner.clean_with(:truncation)
|
||||
Dunlop::NestedLogger.options[:yaml_options][:line_width] = 2000
|
||||
Warden.test_mode!
|
||||
end
|
||||
|
||||
config.before :each do
|
||||
DatabaseCleaner.clean
|
||||
end
|
||||
|
||||
# RSpec Rails can automatically mix in different behaviours to your tests
|
||||
# based on their file location, for example enabling you to call `get` and
|
||||
# `post` in specs under `spec/controllers`.
|
||||
#
|
||||
# You can disable this behaviour by removing the line below, and instead
|
||||
# explicitly tag your specs with their type, e.g.:
|
||||
#
|
||||
# RSpec.describe UsersController, :type => :controller do
|
||||
# # ...
|
||||
# end
|
||||
#
|
||||
# The different available types are documented in the features, such as in
|
||||
# https://relishapp.com/rspec/rspec-rails/docs
|
||||
config.infer_spec_type_from_file_location!
|
||||
|
||||
# Filter lines from Rails gems in backtraces.
|
||||
config.filter_rails_from_backtrace!
|
||||
# arbitrary gems may also be filtered via:
|
||||
# config.filter_gems_from_backtrace("gem name")
|
||||
end
|
||||
@@ -0,0 +1,17 @@
|
||||
describe "app routing" do
|
||||
routes { Dunlop::Ember::Engine.routes }
|
||||
it 'has a root' do
|
||||
expect(get: "/").to route_to(
|
||||
controller: "dunlop/ember/application",
|
||||
action: "ember_path"
|
||||
)
|
||||
end
|
||||
|
||||
it "works with dashes", type: :routing do
|
||||
expect(get: "abc-def").to route_to(
|
||||
controller: "dunlop/ember/application",
|
||||
action: "ember_path",
|
||||
rest: 'abc-def'
|
||||
)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,58 @@
|
||||
RSpec.describe FlatKeys do
|
||||
describe '#as_nested_structure' do
|
||||
it "works" do
|
||||
result = FlatKeys.as_nested_structure([
|
||||
'root_one',
|
||||
'inventories.location.site',
|
||||
'ppls.distribution_cables',
|
||||
'dslams.port_spec',
|
||||
'root_two',
|
||||
'dslams.other_spec',
|
||||
'root_three',
|
||||
#'dslams.other_spec.and_then.some', # should raise
|
||||
'very.deep.nested.structure.just.because.we.can',
|
||||
'very.deep.nested.structure.with.other.tail',
|
||||
'start.with.more.than.what.comes.after',
|
||||
'start.with.more.than.what.comes',
|
||||
'start.with.less.than.what.comes',
|
||||
'start.with.less.than.what.comes2.after',
|
||||
'start.with.less.than.what.comes.after',
|
||||
'start.with.less.than.what.comes2.after', # duplicate, should be no problem
|
||||
])
|
||||
|
||||
expect( result ).to eq [
|
||||
:root_one,
|
||||
:root_two,
|
||||
:root_three,
|
||||
{
|
||||
inventories: {location: :site},
|
||||
ppls: :distribution_cables,
|
||||
dslams: [:port_spec, :other_spec],
|
||||
very: {
|
||||
deep: {
|
||||
nested: {
|
||||
structure: {
|
||||
just: {
|
||||
because: {we: :can}
|
||||
},
|
||||
with: {other: :tail}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
start: {
|
||||
with: {
|
||||
more: {
|
||||
than: {what: {comes: :after}}
|
||||
},
|
||||
less: {
|
||||
than: {what: {comes: :after, comes2: :after}}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,96 @@
|
||||
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
||||
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
||||
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
||||
# this file to always be loaded, without a need to explicitly require it in any
|
||||
# files.
|
||||
#
|
||||
# Given that it is always loaded, you are encouraged to keep this file as
|
||||
# light-weight as possible. Requiring heavyweight dependencies from this file
|
||||
# will add to the boot time of your test suite on EVERY test run, even for an
|
||||
# individual file that may not need all of that loaded. Instead, consider making
|
||||
# a separate helper file that requires the additional dependencies and performs
|
||||
# the additional setup, and require it from the spec files that actually need
|
||||
# it.
|
||||
#
|
||||
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
||||
RSpec.configure do |config|
|
||||
# rspec-expectations config goes here. You can use an alternate
|
||||
# assertion/expectation library such as wrong or the stdlib/minitest
|
||||
# assertions if you prefer.
|
||||
config.expect_with :rspec do |expectations|
|
||||
# This option will default to `true` in RSpec 4. It makes the `description`
|
||||
# and `failure_message` of custom matchers include text for helper methods
|
||||
# defined using `chain`, e.g.:
|
||||
# be_bigger_than(2).and_smaller_than(4).description
|
||||
# # => "be bigger than 2 and smaller than 4"
|
||||
# ...rather than:
|
||||
# # => "be bigger than 2"
|
||||
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
||||
end
|
||||
|
||||
# rspec-mocks config goes here. You can use an alternate test double
|
||||
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
||||
config.mock_with :rspec do |mocks|
|
||||
# Prevents you from mocking or stubbing a method that does not exist on
|
||||
# a real object. This is generally recommended, and will default to
|
||||
# `true` in RSpec 4.
|
||||
mocks.verify_partial_doubles = true
|
||||
end
|
||||
|
||||
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
||||
# have no way to turn it off -- the option exists only for backwards
|
||||
# compatibility in RSpec 3). It causes shared context metadata to be
|
||||
# inherited by the metadata hash of host groups and examples, rather than
|
||||
# triggering implicit auto-inclusion in groups with matching metadata.
|
||||
config.shared_context_metadata_behavior = :apply_to_host_groups
|
||||
|
||||
# The settings below are suggested to provide a good initial experience
|
||||
# with RSpec, but feel free to customize to your heart's content.
|
||||
=begin
|
||||
# This allows you to limit a spec run to individual examples or groups
|
||||
# you care about by tagging them with `:focus` metadata. When nothing
|
||||
# is tagged with `:focus`, all examples get run. RSpec also provides
|
||||
# aliases for `it`, `describe`, and `context` that include `:focus`
|
||||
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
||||
config.filter_run_when_matching :focus
|
||||
|
||||
# Allows RSpec to persist some state between runs in order to support
|
||||
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
||||
# you configure your source control system to ignore this file.
|
||||
config.example_status_persistence_file_path = "spec/examples.txt"
|
||||
|
||||
# Limits the available syntax to the non-monkey patched syntax that is
|
||||
# recommended. For more details, see:
|
||||
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
||||
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
||||
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
||||
config.disable_monkey_patching!
|
||||
|
||||
# Many RSpec users commonly either run the entire suite or an individual
|
||||
# file, and it's useful to allow more verbose output when running an
|
||||
# individual spec file.
|
||||
if config.files_to_run.one?
|
||||
# Use the documentation formatter for detailed output,
|
||||
# unless a formatter has already been configured
|
||||
# (e.g. via a command-line flag).
|
||||
config.default_formatter = "doc"
|
||||
end
|
||||
|
||||
# Print the 10 slowest examples and example groups at the
|
||||
# end of the spec run, to help surface which specs are running
|
||||
# particularly slow.
|
||||
config.profile_examples = 10
|
||||
|
||||
# Run specs in random order to surface order dependencies. If you find an
|
||||
# order dependency and want to debug it, you can fix the order by providing
|
||||
# the seed, which is printed after each run.
|
||||
# --seed 1234
|
||||
config.order = :random
|
||||
|
||||
# Seed global randomization in this process using the `--seed` CLI option.
|
||||
# Setting this allows you to use `--seed` to deterministically reproduce
|
||||
# test failures related to randomization by passing the same `--seed` value
|
||||
# as the one that triggered the failure.
|
||||
Kernel.srand config.seed
|
||||
=end
|
||||
end
|
||||
Reference in New Issue
Block a user