--------------------------------------------------------------------------------
/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/app/views/comments/_comment.html.erb:
--------------------------------------------------------------------------------
1 |
24 | <% end %>
25 |
26 | <%= render "devise/shared/links" %>
27 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/application.css:
--------------------------------------------------------------------------------
1 | /*
2 | * This is a manifest file that'll be compiled into application.css, which will include all the files
3 | * listed below.
4 | *
5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
6 | * vendor/assets/stylesheets directory can be referenced here using a relative path.
7 | *
8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10 | * files in this directory. Styles in this file should be added after the last require_* statement.
11 | * It is generally better to create a new file per style scope.
12 | *
13 | *= require_tree .
14 | *= require_self
15 | */
16 |
--------------------------------------------------------------------------------
/app/assets/javascripts/application.js:
--------------------------------------------------------------------------------
1 | // This is a manifest file that'll be compiled into application.js, which will include all the files
2 | // listed below.
3 | //
4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
5 | // vendor/assets/javascripts directory can be referenced here using a relative path.
6 | //
7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8 | // compiled file. JavaScript code in this file should be added after the last require_* statement.
9 | //
10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11 | // about supported directives.
12 | //
13 | //= require rails-ujs
14 | //= require activestorage
15 | //= require turbolinks
16 | //= require_tree .
17 |
--------------------------------------------------------------------------------
/app/views/posts/_post.html.erb:
--------------------------------------------------------------------------------
1 |
30 | <%= f.label :current_password %> (we need your current password to confirm your changes)
31 | <%= f.password_field :current_password, autocomplete: "current-password" %>
32 |
33 |
34 |
35 | <%= f.submit "Update" %>
36 |
37 | <% end %>
38 |
39 |
Cancel my account
40 |
41 |
Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>
42 |
43 | <%= link_to "Back", :back %>
44 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Scaffold for social media app with Ruby on Rails
2 |
3 | > This repo includes intial code for social media app with basic styling. Its purpose is to be a starting point for Microverse students.
4 |
5 | ## Built With
6 |
7 | - Ruby v2.7.0
8 | - Ruby on Rails v5.2.4
9 |
10 | ## Live Demo
11 |
12 | TBA
13 |
14 |
15 | ## Getting Started
16 |
17 | To get a local copy up and running follow these simple example steps.
18 |
19 | ### Prerequisites
20 |
21 | Ruby: 2.6.3
22 | Rails: 5.2.3
23 | Postgres: >=9.5
24 |
25 | ### Setup
26 |
27 | Instal gems with:
28 |
29 | ```
30 | bundle install
31 | ```
32 |
33 | Setup database with:
34 |
35 | ```
36 | rails db:create
37 | rails db:migrate
38 | ```
39 |
40 | ### Github Actions
41 |
42 | To make sure the linters' checks using Github Actions work properly, you should follow the next steps:
43 |
44 | 1. On your recently forked repo, enable the GitHub Actions in the Actions tab.
45 | 2. Create the `feature/branch` and push.
46 | 3. Start working on your milestone as usual.
47 | 4. Open a PR from the `feature/branch` when your work is done.
48 |
49 |
50 | ### Usage
51 |
52 | Start server with:
53 |
54 | ```
55 | rails server
56 | ```
57 |
58 | Open `http://localhost:3000/` in your browser.
59 |
60 | ### Run tests
61 |
62 | ```
63 | rpsec --format documentation
64 | ```
65 |
66 | > Tests will be added by Microverse students. There are no tests for initial features in order to make sure that students write all tests from scratch.
67 |
68 | ### Deployment
69 |
70 | TBA
71 |
72 | ## Authors
73 |
74 | TBA
75 |
76 | ## 🤝 Contributing
77 |
78 | Contributions, issues and feature requests are welcome!
79 |
80 | Feel free to check the [issues page](issues/).
81 |
82 | ## Show your support
83 |
84 | Give a ⭐️ if you like this project!
85 |
86 | ## Acknowledgments
87 |
88 | TBA
89 |
90 | ## 📝 License
91 |
92 | TBA
93 |
94 |
--------------------------------------------------------------------------------
/public/500.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | We're sorry, but something went wrong (500)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
We're sorry, but something went wrong.
62 |
63 |
If you are the application owner check the logs for more information.
Maybe you tried to change something you didn't have access to.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The page you were looking for doesn't exist.
62 |
You may have mistyped the address or the page may have moved.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # The test environment is used exclusively to run your application's
5 | # test suite. You never need to work with it otherwise. Remember that
6 | # your test database is "scratch space" for the test suite and is wiped
7 | # and recreated between test runs. Don't rely on the data there!
8 | config.cache_classes = true
9 |
10 | # Do not eager load code on boot. This avoids loading your whole application
11 | # just for the purpose of running a single test. If you are using a tool that
12 | # preloads Rails for running tests, you may have to set it to true.
13 | config.eager_load = false
14 |
15 | # Configure public file server for tests with Cache-Control for performance.
16 | config.public_file_server.enabled = true
17 | config.public_file_server.headers = {
18 | 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
19 | }
20 |
21 | # Show full error reports and disable caching.
22 | config.consider_all_requests_local = true
23 | config.action_controller.perform_caching = false
24 |
25 | # Raise exceptions instead of rendering exception templates.
26 | config.action_dispatch.show_exceptions = false
27 |
28 | # Disable request forgery protection in test environment.
29 | config.action_controller.allow_forgery_protection = false
30 |
31 | # Store uploaded files on the local file system in a temporary directory
32 | config.active_storage.service = :test
33 |
34 | config.action_mailer.perform_caching = false
35 |
36 | # Tell Action Mailer not to deliver emails to the real world.
37 | # The :test delivery method accumulates sent emails in the
38 | # ActionMailer::Base.deliveries array.
39 | config.action_mailer.delivery_method = :test
40 |
41 | # Print deprecation notices to the stderr.
42 | config.active_support.deprecation = :stderr
43 |
44 | # Raises error for missing translations
45 | # config.action_view.raise_on_missing_translations = true
46 | end
47 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 | git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3 |
4 | ruby '2.7.0'
5 |
6 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
7 | gem 'rails', '~> 5.2.4'
8 | # Use postgresql as the database for Active Record
9 | gem 'pg', '>= 0.18', '< 2.0'
10 | # Use Puma as the app server
11 | gem 'puma', '~> 3.12'
12 | # Use SCSS for stylesheets
13 | gem 'sass-rails', '~> 5.0'
14 | # Use Uglifier as compressor for JavaScript assets
15 | gem 'uglifier', '>= 1.3.0'
16 | # See https://github.com/rails/execjs#readme for more supported runtimes
17 | # gem 'mini_racer', platforms: :ruby
18 |
19 | # Use CoffeeScript for .coffee assets and views
20 | gem 'coffee-rails', '~> 4.2'
21 | # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
22 | gem 'turbolinks', '~> 5'
23 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
24 | gem 'jbuilder', '~> 2.5'
25 | # Use Redis adapter to run Action Cable in production
26 | # gem 'redis', '~> 4.0'
27 | # Use ActiveModel has_secure_password
28 | # gem 'bcrypt', '~> 3.1.7'
29 | # Install wdm Gem if the platform is Windows
30 | gem 'wdm', '>= 0.1.0' if Gem.win_platform?
31 | # Use ActiveStorage variant
32 | # gem 'mini_magick', '~> 4.8'
33 |
34 | # Use Capistrano for deployment
35 | # gem 'capistrano-rails', group: :development
36 |
37 | # Reduces boot times through caching; required in config/boot.rb
38 | gem 'bootsnap', '>= 1.1.0', require: false
39 |
40 | gem 'devise'
41 |
42 | group :development, :test do
43 | # Call 'byebug' anywhere in the code to stop execution and get a debugger console
44 | gem 'byebug', platforms: %i[mri mingw x64_mingw]
45 | end
46 |
47 | group :test do
48 | gem 'rspec'
49 | end
50 |
51 | group :development do
52 | # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
53 | gem 'listen', '>= 3.0.5', '< 3.2'
54 | gem 'web-console', '>= 3.3.0'
55 | # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
56 | gem 'rubocop'
57 | gem 'spring'
58 | gem 'spring-watcher-listen', '~> 2.0.0'
59 | end
60 |
61 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
62 | gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
63 |
--------------------------------------------------------------------------------
/db/schema.rb:
--------------------------------------------------------------------------------
1 | # This file is auto-generated from the current state of the database. Instead
2 | # of editing this file, please use the migrations feature of Active Record to
3 | # incrementally modify your database, and then regenerate this schema definition.
4 | #
5 | # Note that this schema.rb definition is the authoritative source for your
6 | # database schema. If you need to create the application database on another
7 | # system, you should be using db:schema:load, not running all the migrations
8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9 | # you'll amass, the slower it'll run and the greater likelihood for issues).
10 | #
11 | # It's strongly recommended that you check this file into your version control system.
12 |
13 | ActiveRecord::Schema.define(version: 2020_02_04_165841) do
14 |
15 | # These are extensions that must be enabled in order to support this database
16 | enable_extension "plpgsql"
17 |
18 | create_table "comments", force: :cascade do |t|
19 | t.integer "user_id"
20 | t.integer "post_id"
21 | t.text "content"
22 | t.datetime "created_at", null: false
23 | t.datetime "updated_at", null: false
24 | t.index ["post_id"], name: "index_comments_on_post_id"
25 | t.index ["user_id"], name: "index_comments_on_user_id"
26 | end
27 |
28 | create_table "likes", force: :cascade do |t|
29 | t.integer "post_id"
30 | t.integer "user_id"
31 | t.index ["post_id"], name: "index_likes_on_post_id"
32 | t.index ["user_id"], name: "index_likes_on_user_id"
33 | end
34 |
35 | create_table "posts", force: :cascade do |t|
36 | t.integer "user_id"
37 | t.text "content"
38 | t.datetime "created_at", null: false
39 | t.datetime "updated_at", null: false
40 | t.index ["user_id"], name: "index_posts_on_user_id"
41 | end
42 |
43 | create_table "users", force: :cascade do |t|
44 | t.string "email", default: "", null: false
45 | t.string "encrypted_password", default: "", null: false
46 | t.string "reset_password_token"
47 | t.datetime "reset_password_sent_at"
48 | t.datetime "remember_created_at"
49 | t.datetime "created_at", null: false
50 | t.datetime "updated_at", null: false
51 | t.string "name"
52 | t.string "gravatar_url"
53 | t.index ["email"], name: "index_users_on_email", unique: true
54 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
55 | end
56 |
57 | end
58 |
--------------------------------------------------------------------------------
/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # In the development environment your application's code is reloaded on
5 | # every request. This slows down response time but is perfect for development
6 | # since you don't have to restart the web server when you make code changes.
7 | config.cache_classes = false
8 |
9 | # Do not eager load code on boot.
10 | config.eager_load = false
11 |
12 | # Show full error reports.
13 | config.consider_all_requests_local = true
14 |
15 | # Enable/disable caching. By default caching is disabled.
16 | # Run rails dev:cache to toggle caching.
17 | if Rails.root.join('tmp', 'caching-dev.txt').exist?
18 | config.action_controller.perform_caching = true
19 |
20 | config.cache_store = :memory_store
21 | config.public_file_server.headers = {
22 | 'Cache-Control' => "public, max-age=#{2.days.to_i}"
23 | }
24 | else
25 | config.action_controller.perform_caching = false
26 |
27 | config.cache_store = :null_store
28 | end
29 |
30 | # Store uploaded files on the local file system (see config/storage.yml for options)
31 | config.active_storage.service = :local
32 |
33 | # Don't care if the mailer can't send.
34 | config.action_mailer.raise_delivery_errors = false
35 |
36 | config.action_mailer.perform_caching = false
37 |
38 | # Print deprecation notices to the Rails logger.
39 | config.active_support.deprecation = :log
40 |
41 | # Raise an error on page load if there are pending migrations.
42 | config.active_record.migration_error = :page_load
43 |
44 | # Highlight code that triggered database queries in logs.
45 | config.active_record.verbose_query_logs = true
46 |
47 | # Debug mode disables concatenation and preprocessing of assets.
48 | # This option may cause significant delays in view rendering with a large
49 | # number of complex assets.
50 | config.assets.debug = true
51 |
52 | # Suppress logger output for asset requests.
53 | config.assets.quiet = true
54 |
55 | # Raises error for missing translations
56 | # config.action_view.raise_on_missing_translations = true
57 |
58 | # Use an evented file watcher to asynchronously detect changes in source code,
59 | # routes, locales, etc. This feature depends on the listen gem.
60 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker
61 |
62 | # Devise auth config
63 | config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
64 | end
65 |
--------------------------------------------------------------------------------
/config/database.yml:
--------------------------------------------------------------------------------
1 | # PostgreSQL. Versions 9.1 and up are supported.
2 | #
3 | # Install the pg driver:
4 | # gem install pg
5 | # On OS X with Homebrew:
6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config
7 | # On OS X with MacPorts:
8 | # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
9 | # On Windows:
10 | # gem install pg
11 | # Choose the win32 build.
12 | # Install PostgreSQL and put its /bin directory on your path.
13 | #
14 | # Configure Using Gemfile
15 | # gem 'pg'
16 | #
17 | default: &default
18 | adapter: postgresql
19 | encoding: unicode
20 | # For details on connection pooling, see Rails configuration guide
21 | # http://guides.rubyonrails.org/configuring.html#database-pooling
22 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
23 |
24 | development:
25 | <<: *default
26 | database: ror_social_scaffold_development
27 |
28 | # The specified database role being used to connect to postgres.
29 | # To create additional roles in postgres see `$ createuser --help`.
30 | # When left blank, postgres will use the default role. This is
31 | # the same name as the operating system user that initialized the database.
32 | #username: ror_social_scaffold
33 |
34 | # The password associated with the postgres role (username).
35 | #password:
36 |
37 | # Connect on a TCP socket. Omitted by default since the client uses a
38 | # domain socket that doesn't need configuration. Windows does not have
39 | # domain sockets, so uncomment these lines.
40 | #host: localhost
41 |
42 | # The TCP port the server listens on. Defaults to 5432.
43 | # If your server runs on a different port number, change accordingly.
44 | #port: 5432
45 |
46 | # Schema search path. The server defaults to $user,public
47 | #schema_search_path: myapp,sharedapp,public
48 |
49 | # Minimum log levels, in increasing order:
50 | # debug5, debug4, debug3, debug2, debug1,
51 | # log, notice, warning, error, fatal, and panic
52 | # Defaults to warning.
53 | #min_messages: notice
54 |
55 | # Warning: The database defined as "test" will be erased and
56 | # re-generated from your development database when you run "rake".
57 | # Do not set this db to the same as development or production.
58 | test:
59 | <<: *default
60 | database: ror_social_scaffold_test
61 |
62 | # As with config/secrets.yml, you never want to store sensitive information,
63 | # like your database password, in your source code. If your source code is
64 | # ever seen by anyone, they now have access to your database.
65 | #
66 | # Instead, provide the password as a unix environment variable when you boot
67 | # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
68 | # for a full rundown on how to provide these environment variables in a
69 | # production deployment.
70 | #
71 | # On Heroku and other platform providers, you may have a full connection URL
72 | # available as an environment variable. For example:
73 | #
74 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
75 | #
76 | # You can use this database configuration with:
77 | #
78 | # production:
79 | # url: <%= ENV['DATABASE_URL'] %>
80 | #
81 | production:
82 | <<: *default
83 | database: ror_social_scaffold_production
84 | username: ror_social_scaffold
85 | password: <%= ENV['ROR_SOCIAL_SCAFFOLD_DATABASE_PASSWORD'] %>
86 |
--------------------------------------------------------------------------------
/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # Code is not reloaded between requests.
5 | config.cache_classes = true
6 |
7 | # Eager load code on boot. This eager loads most of Rails and
8 | # your application in memory, allowing both threaded web servers
9 | # and those relying on copy on write to perform better.
10 | # Rake tasks automatically ignore this option for performance.
11 | config.eager_load = true
12 |
13 | # Full error reports are disabled and caching is turned on.
14 | config.consider_all_requests_local = false
15 | config.action_controller.perform_caching = true
16 |
17 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
18 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
19 | # config.require_master_key = true
20 |
21 | # Disable serving static files from the `/public` folder by default since
22 | # Apache or NGINX already handles this.
23 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
24 |
25 | # Compress JavaScripts and CSS.
26 | config.assets.js_compressor = :uglifier
27 | # config.assets.css_compressor = :sass
28 |
29 | # Do not fallback to assets pipeline if a precompiled asset is missed.
30 | config.assets.compile = false
31 |
32 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
33 |
34 | # Enable serving of images, stylesheets, and JavaScripts from an asset server.
35 | # config.action_controller.asset_host = 'http://assets.example.com'
36 |
37 | # Specifies the header that your server uses for sending files.
38 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
39 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
40 |
41 | # Store uploaded files on the local file system (see config/storage.yml for options)
42 | config.active_storage.service = :local
43 |
44 | # Mount Action Cable outside main process or domain
45 | # config.action_cable.mount_path = nil
46 | # config.action_cable.url = 'wss://example.com/cable'
47 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
48 |
49 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
50 | # config.force_ssl = true
51 |
52 | # Use the lowest log level to ensure availability of diagnostic information
53 | # when problems arise.
54 | config.log_level = :debug
55 |
56 | # Prepend all log lines with the following tags.
57 | config.log_tags = [ :request_id ]
58 |
59 | # Use a different cache store in production.
60 | # config.cache_store = :mem_cache_store
61 |
62 | # Use a real queuing backend for Active Job (and separate queues per environment)
63 | # config.active_job.queue_adapter = :resque
64 | # config.active_job.queue_name_prefix = "ror_social_scaffold_#{Rails.env}"
65 |
66 | config.action_mailer.perform_caching = false
67 |
68 | # Ignore bad email addresses and do not raise email delivery errors.
69 | # Set this to true and configure the email server for immediate delivery to raise delivery errors.
70 | # config.action_mailer.raise_delivery_errors = false
71 |
72 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
73 | # the I18n.default_locale when a translation cannot be found).
74 | config.i18n.fallbacks = true
75 |
76 | # Send deprecation notices to registered listeners.
77 | config.active_support.deprecation = :notify
78 |
79 | # Use default logging formatter so that PID and timestamp are not suppressed.
80 | config.log_formatter = ::Logger::Formatter.new
81 |
82 | # Use a different logger for distributed setups.
83 | # require 'syslog/logger'
84 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
85 |
86 | if ENV["RAILS_LOG_TO_STDOUT"].present?
87 | logger = ActiveSupport::Logger.new(STDOUT)
88 | logger.formatter = config.log_formatter
89 | config.logger = ActiveSupport::TaggedLogging.new(logger)
90 | end
91 |
92 | # Do not dump schema after migrations.
93 | config.active_record.dump_schema_after_migration = false
94 | end
95 |
--------------------------------------------------------------------------------
/config/locales/devise.en.yml:
--------------------------------------------------------------------------------
1 | # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2 |
3 | en:
4 | devise:
5 | confirmations:
6 | confirmed: "Your email address has been successfully confirmed."
7 | send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
8 | 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."
9 | failure:
10 | already_authenticated: "You are already signed in."
11 | inactive: "Your account is not activated yet."
12 | invalid: "Invalid %{authentication_keys} or password."
13 | locked: "Your account is locked."
14 | last_attempt: "You have one more attempt before your account is locked."
15 | not_found_in_database: "Invalid %{authentication_keys} or password."
16 | timeout: "Your session expired. Please sign in again to continue."
17 | unauthenticated: "You need to sign in or sign up before continuing."
18 | unconfirmed: "You have to confirm your email address before continuing."
19 | mailer:
20 | confirmation_instructions:
21 | subject: "Confirmation instructions"
22 | reset_password_instructions:
23 | subject: "Reset password instructions"
24 | unlock_instructions:
25 | subject: "Unlock instructions"
26 | email_changed:
27 | subject: "Email Changed"
28 | password_change:
29 | subject: "Password Changed"
30 | omniauth_callbacks:
31 | failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
32 | success: "Successfully authenticated from %{kind} account."
33 | passwords:
34 | 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."
35 | send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
36 | 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."
37 | updated: "Your password has been changed successfully. You are now signed in."
38 | updated_not_active: "Your password has been changed successfully."
39 | registrations:
40 | destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
41 | signed_up: "Welcome! You have signed up successfully."
42 | signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
43 | signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
44 | 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."
45 | update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address."
46 | updated: "Your account has been updated successfully."
47 | updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again"
48 | sessions:
49 | signed_in: "Signed in successfully."
50 | signed_out: "Signed out successfully."
51 | already_signed_out: "Signed out successfully."
52 | unlocks:
53 | send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
54 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
55 | unlocked: "Your account has been unlocked successfully. Please sign in to continue."
56 | errors:
57 | messages:
58 | already_confirmed: "was already confirmed, please try signing in"
59 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
60 | expired: "has expired, please request a new one"
61 | not_found: "not found"
62 | not_locked: "was not locked"
63 | not_saved:
64 | one: "1 error prohibited this %{resource} from being saved:"
65 | other: "%{count} errors prohibited this %{resource} from being saved:"
66 |
--------------------------------------------------------------------------------
/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # This file was generated by the `rspec --init` command. Conventionally, all
2 | # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3 | # The generated `.rspec` file contains `--require spec_helper` which will cause
4 | # this file to always be loaded, without a need to explicitly require it in any
5 | # files.
6 | #
7 | # Given that it is always loaded, you are encouraged to keep this file as
8 | # light-weight as possible. Requiring heavyweight dependencies from this file
9 | # will add to the boot time of your test suite on EVERY test run, even for an
10 | # individual file that may not need all of that loaded. Instead, consider making
11 | # a separate helper file that requires the additional dependencies and performs
12 | # the additional setup, and require it from the spec files that actually need
13 | # it.
14 | #
15 | # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
16 | RSpec.configure do |config|
17 | # rspec-expectations config goes here. You can use an alternate
18 | # assertion/expectation library such as wrong or the stdlib/minitest
19 | # assertions if you prefer.
20 | config.expect_with :rspec do |expectations|
21 | # This option will default to `true` in RSpec 4. It makes the `description`
22 | # and `failure_message` of custom matchers include text for helper methods
23 | # defined using `chain`, e.g.:
24 | # be_bigger_than(2).and_smaller_than(4).description
25 | # # => "be bigger than 2 and smaller than 4"
26 | # ...rather than:
27 | # # => "be bigger than 2"
28 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true
29 | end
30 |
31 | # rspec-mocks config goes here. You can use an alternate test double
32 | # library (such as bogus or mocha) by changing the `mock_with` option here.
33 | config.mock_with :rspec do |mocks|
34 | # Prevents you from mocking or stubbing a method that does not exist on
35 | # a real object. This is generally recommended, and will default to
36 | # `true` in RSpec 4.
37 | mocks.verify_partial_doubles = true
38 | end
39 |
40 | # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
41 | # have no way to turn it off -- the option exists only for backwards
42 | # compatibility in RSpec 3). It causes shared context metadata to be
43 | # inherited by the metadata hash of host groups and examples, rather than
44 | # triggering implicit auto-inclusion in groups with matching metadata.
45 | config.shared_context_metadata_behavior = :apply_to_host_groups
46 |
47 | # The settings below are suggested to provide a good initial experience
48 | # with RSpec, but feel free to customize to your heart's content.
49 | # # This allows you to limit a spec run to individual examples or groups
50 | # # you care about by tagging them with `:focus` metadata. When nothing
51 | # # is tagged with `:focus`, all examples get run. RSpec also provides
52 | # # aliases for `it`, `describe`, and `context` that include `:focus`
53 | # # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
54 | # config.filter_run_when_matching :focus
55 | #
56 | # # Allows RSpec to persist some state between runs in order to support
57 | # # the `--only-failures` and `--next-failure` CLI options. We recommend
58 | # # you configure your source control system to ignore this file.
59 | # config.example_status_persistence_file_path = "spec/examples.txt"
60 | #
61 | # # Limits the available syntax to the non-monkey patched syntax that is
62 | # # recommended. For more details, see:
63 | # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
64 | # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
65 | # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
66 | # config.disable_monkey_patching!
67 | #
68 | # # This setting enables warnings. It's recommended, but in some cases may
69 | # # be too noisy due to issues in dependencies.
70 | # config.warnings = true
71 | #
72 | # # Many RSpec users commonly either run the entire suite or an individual
73 | # # file, and it's useful to allow more verbose output when running an
74 | # # individual spec file.
75 | # if config.files_to_run.one?
76 | # # Use the documentation formatter for detailed output,
77 | # # unless a formatter has already been configured
78 | # # (e.g. via a command-line flag).
79 | # config.default_formatter = "doc"
80 | # end
81 | #
82 | # # Print the 10 slowest examples and example groups at the
83 | # # end of the spec run, to help surface which specs are running
84 | # # particularly slow.
85 | # config.profile_examples = 10
86 | #
87 | # # Run specs in random order to surface order dependencies. If you find an
88 | # # order dependency and want to debug it, you can fix the order by providing
89 | # # the seed, which is printed after each run.
90 | # # --seed 1234
91 | # config.order = :random
92 | #
93 | # # Seed global randomization in this process using the `--seed` CLI option.
94 | # # Setting this allows you to use `--seed` to deterministically reproduce
95 | # # test failures related to randomization by passing the same `--seed` value
96 | # # as the one that triggered the failure.
97 | # Kernel.srand config.seed
98 | end
99 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/custom.scss:
--------------------------------------------------------------------------------
1 | @import url("https://fonts.googleapis.com/css?family=Roboto:400,700,900&display=swap");
2 |
3 | $primary-color-dark: #689f38;
4 | $primary-color: #8bc34a;
5 | $primary-color-light: #dcedc8;
6 | $primary-color-text: #212121;
7 | $divider-color: #bdbdbd;
8 |
9 | * {
10 | margin: 0;
11 | padding: 0;
12 | box-sizing: border-box;
13 | outline: none;
14 | }
15 |
16 | body {
17 | background: #fff;
18 | position: relative;
19 | font-family: "Roboto", sans-serif;
20 | font-weight: 400;
21 | }
22 |
23 | h1,
24 | h2,
25 | h3 {
26 | font-weight: 700;
27 | }
28 |
29 | ul {
30 | list-style-type: none;
31 | }
32 |
33 | a {
34 | text-decoration: none;
35 | color: $primary-color-text;
36 | }
37 |
38 | .nav {
39 | display: flex;
40 | justify-content: space-between;
41 | padding: 16px 48px;
42 | background-color: $primary-color-dark;
43 | color: $primary-color-light;
44 |
45 | a {
46 | color: $primary-color-light;
47 | text-transform: uppercase;
48 | font-weight: 900;
49 | }
50 |
51 | .active a {
52 | color: #fff;
53 | }
54 |
55 | a:hover {
56 | color: #fff;
57 | }
58 |
59 | .menu {
60 | width: 80%;
61 | justify-content: space-between;
62 |
63 | .menu-item {
64 | float: left;
65 | margin: 0 15px;
66 | }
67 | }
68 | }
69 |
70 | .main {
71 | display: flex;
72 | flex-direction: column;
73 | align-items: center;
74 | padding: 16px;
75 | }
76 |
77 | .notice,
78 | .alert {
79 | margin-bottom: 8px;
80 | width: 100%;
81 | height: 30px;
82 | text-align: center;
83 | padding: 5px;
84 | color: dimgrey;
85 | font-size: 14px;
86 | }
87 |
88 | .notice {
89 | background-color: #d4f6c6;
90 | }
91 |
92 | .alert {
93 | background-color: #f6cfc6;
94 | }
95 |
96 | .errors {
97 | font-size: 10px;
98 | color: red;
99 | }
100 |
101 | .new_post,
102 | .new_comment {
103 | display: flex;
104 | flex-direction: column;
105 | align-items: center;
106 | width: 100%;
107 |
108 | label {
109 | display: none;
110 | }
111 |
112 | .form-control {
113 | width: 100%;
114 | border: 1px solid $divider-color;
115 | height: 64px;
116 | padding: 8px;
117 | margin: 4px 0;
118 | border-radius: 4px;
119 | }
120 |
121 | .field_with_errors {
122 | width: 100%;
123 |
124 | .form-control {
125 | border: 1px solid #f00;
126 | }
127 | }
128 |
129 | .btn-primary {
130 | width: 100%;
131 | }
132 |
133 | .btn-secondary {
134 | width: 30%;
135 | margin-left: 70%;
136 | }
137 | }
138 |
139 | form {
140 | width: 80%;
141 | margin: 8px 0;
142 |
143 | .field {
144 | width: 100%;
145 | padding: 8px 0;
146 |
147 | label {
148 | margin-bottom: 8px;
149 | }
150 |
151 | input {
152 | width: 100%;
153 | border: 1px solid $divider-color;
154 | border-radius: 4px;
155 | padding: 8px;
156 | background-color: $primary-color-light;
157 | }
158 |
159 | input[type="checkbox"] {
160 | width: fit-content;
161 | }
162 | }
163 |
164 | .actions {
165 | display: flex;
166 | justify-content: center;
167 | margin: 8px 0;
168 | }
169 |
170 | input[type="submit"] {
171 | padding: 8px;
172 | width: 50%;
173 | border: none;
174 | border-radius: 4px;
175 | background-color: $primary-color-dark;
176 | color: $primary-color-light;
177 | text-transform: uppercase;
178 | font-weight: 900;
179 | }
180 |
181 | input[type="submit"]:hover {
182 | background-color: $primary-color;
183 | color: #fff;
184 | }
185 |
186 | .actions.reset {
187 | input[type="submit"] {
188 | width: 100%;
189 | }
190 | }
191 | }
192 |
193 | .title {
194 | text-align: center;
195 | margin-bottom: 16px;
196 | text-transform: capitalize;
197 | }
198 |
199 | .timeline {
200 | width: 100%;
201 | margin: 16px 0;
202 | display: flex;
203 | flex-direction: column;
204 | align-items: center;
205 |
206 | h3 {
207 | margin: 8px 0;
208 | }
209 |
210 | .posts {
211 | width: 100%;
212 | }
213 |
214 | .post {
215 | width: 100%;
216 | margin: 16px 0;
217 | display: flex;
218 | flex-direction: column;
219 | }
220 |
221 | .post-attribution {
222 | float: left;
223 |
224 | .post-author {
225 | margin: 0 0 8px 0;
226 | color: $primary-color-dark;
227 | text-transform: capitalize;
228 | }
229 | }
230 |
231 | .post-liking {
232 | float: right;
233 |
234 | a {
235 | color: $primary-color-dark;
236 | font-weight: bold;
237 | font-size: 0.9em;
238 | margin: 0 4px;
239 | }
240 |
241 | .post-date {
242 | font-size: 0.6em;
243 | }
244 | }
245 |
246 | .post-content {
247 | font-size: 1.1em;
248 | padding: 4px 0;
249 | }
250 |
251 | .post-comments-section {
252 | margin: 5px;
253 | width: 90%;
254 | margin-left: 10%;
255 |
256 | .post-comments {
257 | position: relative;
258 | display: flex;
259 | border-bottom: 1px solid $divider-color;
260 | border-radius: 3px;
261 | margin-bottom: 2px;
262 | padding: 10px;
263 |
264 | p {
265 | font-size: 0.8em;
266 | width: 90%;
267 | }
268 |
269 | span {
270 | position: absolute;
271 | right: 3px;
272 | font-size: 0.6em;
273 | }
274 | }
275 | }
276 | }
277 |
278 | .users-section {
279 | width: 100%;
280 | margin: 10px;
281 |
282 | .users-list li {
283 | margin-bottom: 16px;
284 | text-transform: capitalize;
285 | font-size: 1.2em;
286 | }
287 |
288 | .profile-link {
289 | font-size: 0.8em;
290 | margin: 0 0 8px 0;
291 | color: $primary-color-dark;
292 | }
293 | }
294 |
295 | .user-section {
296 | width: 100%;
297 | margin-left: 16px;
298 |
299 | h2 {
300 | text-transform: capitalize;
301 | }
302 |
303 | .timeline {
304 | width: 100%;
305 |
306 | h3 {
307 | width: 100%;
308 | }
309 |
310 | justify-content: start;
311 | }
312 | }
313 |
314 | #error_explanation {
315 | h2 {
316 | color: $primary-color-text;
317 | font-size: 1em;
318 | }
319 |
320 | ul {
321 | color: #f00;
322 | }
323 | }
324 |
325 | @media only screen and (min-width: 480px) {
326 | form {
327 | width: 60%;
328 | }
329 |
330 | .new_post,
331 | .timeline,
332 | .users-section,
333 | .user-section {
334 | width: 70%;
335 | }
336 | }
337 |
338 | @media (min-width: 780px) {
339 | form {
340 | width: 40%;
341 | }
342 |
343 | .new_post,
344 | .timeline,
345 | .users-section,
346 | .user-section {
347 | width: 50%;
348 | }
349 | }
350 |
--------------------------------------------------------------------------------
/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | actioncable (5.2.4.1)
5 | actionpack (= 5.2.4.1)
6 | nio4r (~> 2.0)
7 | websocket-driver (>= 0.6.1)
8 | actionmailer (5.2.4.1)
9 | actionpack (= 5.2.4.1)
10 | actionview (= 5.2.4.1)
11 | activejob (= 5.2.4.1)
12 | mail (~> 2.5, >= 2.5.4)
13 | rails-dom-testing (~> 2.0)
14 | actionpack (5.2.4.1)
15 | actionview (= 5.2.4.1)
16 | activesupport (= 5.2.4.1)
17 | rack (~> 2.0, >= 2.0.8)
18 | rack-test (>= 0.6.3)
19 | rails-dom-testing (~> 2.0)
20 | rails-html-sanitizer (~> 1.0, >= 1.0.2)
21 | actionview (5.2.4.1)
22 | activesupport (= 5.2.4.1)
23 | builder (~> 3.1)
24 | erubi (~> 1.4)
25 | rails-dom-testing (~> 2.0)
26 | rails-html-sanitizer (~> 1.0, >= 1.0.3)
27 | activejob (5.2.4.1)
28 | activesupport (= 5.2.4.1)
29 | globalid (>= 0.3.6)
30 | activemodel (5.2.4.1)
31 | activesupport (= 5.2.4.1)
32 | activerecord (5.2.4.1)
33 | activemodel (= 5.2.4.1)
34 | activesupport (= 5.2.4.1)
35 | arel (>= 9.0)
36 | activestorage (5.2.4.1)
37 | actionpack (= 5.2.4.1)
38 | activerecord (= 5.2.4.1)
39 | marcel (~> 0.3.1)
40 | activesupport (5.2.4.1)
41 | concurrent-ruby (~> 1.0, >= 1.0.2)
42 | i18n (>= 0.7, < 2)
43 | minitest (~> 5.1)
44 | tzinfo (~> 1.1)
45 | arel (9.0.0)
46 | ast (2.4.0)
47 | bcrypt (3.1.13)
48 | bindex (0.8.1)
49 | bootsnap (1.4.6)
50 | msgpack (~> 1.0)
51 | builder (3.2.4)
52 | byebug (11.1.1)
53 | coffee-rails (4.2.2)
54 | coffee-script (>= 2.2.0)
55 | railties (>= 4.0.0)
56 | coffee-script (2.4.1)
57 | coffee-script-source
58 | execjs
59 | coffee-script-source (1.12.2)
60 | concurrent-ruby (1.1.6)
61 | crass (1.0.6)
62 | devise (4.7.1)
63 | bcrypt (~> 3.0)
64 | orm_adapter (~> 0.1)
65 | railties (>= 4.1.0)
66 | responders
67 | warden (~> 1.2.3)
68 | diff-lcs (1.3)
69 | erubi (1.9.0)
70 | execjs (2.7.0)
71 | ffi (1.12.2)
72 | ffi (1.12.2-x64-mingw32)
73 | globalid (0.4.2)
74 | activesupport (>= 4.2.0)
75 | i18n (1.8.2)
76 | concurrent-ruby (~> 1.0)
77 | jaro_winkler (1.5.4)
78 | jbuilder (2.10.0)
79 | activesupport (>= 5.0.0)
80 | listen (3.1.5)
81 | rb-fsevent (~> 0.9, >= 0.9.4)
82 | rb-inotify (~> 0.9, >= 0.9.7)
83 | ruby_dep (~> 1.2)
84 | loofah (2.4.0)
85 | crass (~> 1.0.2)
86 | nokogiri (>= 1.5.9)
87 | mail (2.7.1)
88 | mini_mime (>= 0.1.1)
89 | marcel (0.3.3)
90 | mimemagic (~> 0.3.2)
91 | method_source (0.9.2)
92 | mimemagic (0.3.4)
93 | mini_mime (1.0.2)
94 | mini_portile2 (2.5.0)
95 | minitest (5.14.0)
96 | msgpack (1.3.3)
97 | msgpack (1.3.3-x64-mingw32)
98 | nio4r (2.5.2)
99 | nokogiri (1.11.1)
100 | mini_portile2 (~> 2.5.0)
101 | racc (~> 1.4)
102 | nokogiri (1.11.1-x64-mingw32)
103 | racc (~> 1.4)
104 | orm_adapter (0.5.0)
105 | parallel (1.19.1)
106 | parser (2.7.0.4)
107 | ast (~> 2.4.0)
108 | pg (1.2.2)
109 | pg (1.2.2-x64-mingw32)
110 | puma (3.12.6)
111 | racc (1.5.2)
112 | rack (2.2.3)
113 | rack-test (1.1.0)
114 | rack (>= 1.0, < 3)
115 | rails (5.2.4.1)
116 | actioncable (= 5.2.4.1)
117 | actionmailer (= 5.2.4.1)
118 | actionpack (= 5.2.4.1)
119 | actionview (= 5.2.4.1)
120 | activejob (= 5.2.4.1)
121 | activemodel (= 5.2.4.1)
122 | activerecord (= 5.2.4.1)
123 | activestorage (= 5.2.4.1)
124 | activesupport (= 5.2.4.1)
125 | bundler (>= 1.3.0)
126 | railties (= 5.2.4.1)
127 | sprockets-rails (>= 2.0.0)
128 | rails-dom-testing (2.0.3)
129 | activesupport (>= 4.2.0)
130 | nokogiri (>= 1.6)
131 | rails-html-sanitizer (1.3.0)
132 | loofah (~> 2.3)
133 | railties (5.2.4.1)
134 | actionpack (= 5.2.4.1)
135 | activesupport (= 5.2.4.1)
136 | method_source
137 | rake (>= 0.8.7)
138 | thor (>= 0.19.0, < 2.0)
139 | rainbow (3.0.0)
140 | rake (13.0.1)
141 | rb-fsevent (0.10.3)
142 | rb-inotify (0.10.1)
143 | ffi (~> 1.0)
144 | responders (3.0.0)
145 | actionpack (>= 5.0)
146 | railties (>= 5.0)
147 | rexml (3.2.4)
148 | rspec (3.9.0)
149 | rspec-core (~> 3.9.0)
150 | rspec-expectations (~> 3.9.0)
151 | rspec-mocks (~> 3.9.0)
152 | rspec-core (3.9.1)
153 | rspec-support (~> 3.9.1)
154 | rspec-expectations (3.9.1)
155 | diff-lcs (>= 1.2.0, < 2.0)
156 | rspec-support (~> 3.9.0)
157 | rspec-mocks (3.9.1)
158 | diff-lcs (>= 1.2.0, < 2.0)
159 | rspec-support (~> 3.9.0)
160 | rspec-support (3.9.2)
161 | rubocop (0.80.1)
162 | jaro_winkler (~> 1.5.1)
163 | parallel (~> 1.10)
164 | parser (>= 2.7.0.1)
165 | rainbow (>= 2.2.2, < 4.0)
166 | rexml
167 | ruby-progressbar (~> 1.7)
168 | unicode-display_width (>= 1.4.0, < 1.7)
169 | ruby-progressbar (1.10.1)
170 | ruby_dep (1.5.0)
171 | sass (3.7.4)
172 | sass-listen (~> 4.0.0)
173 | sass-listen (4.0.0)
174 | rb-fsevent (~> 0.9, >= 0.9.4)
175 | rb-inotify (~> 0.9, >= 0.9.7)
176 | sass-rails (5.1.0)
177 | railties (>= 5.2.0)
178 | sass (~> 3.1)
179 | sprockets (>= 2.8, < 4.0)
180 | sprockets-rails (>= 2.0, < 4.0)
181 | tilt (>= 1.1, < 3)
182 | spring (2.1.0)
183 | spring-watcher-listen (2.0.1)
184 | listen (>= 2.7, < 4.0)
185 | spring (>= 1.2, < 3.0)
186 | sprockets (3.7.2)
187 | concurrent-ruby (~> 1.0)
188 | rack (> 1, < 3)
189 | sprockets-rails (3.2.1)
190 | actionpack (>= 4.0)
191 | activesupport (>= 4.0)
192 | sprockets (>= 3.0.0)
193 | thor (1.0.1)
194 | thread_safe (0.3.6)
195 | tilt (2.0.10)
196 | turbolinks (5.2.1)
197 | turbolinks-source (~> 5.2)
198 | turbolinks-source (5.2.0)
199 | tzinfo (1.2.6)
200 | thread_safe (~> 0.1)
201 | tzinfo-data (1.2020.1)
202 | tzinfo (>= 1.0.0)
203 | uglifier (4.2.0)
204 | execjs (>= 0.3.0, < 3)
205 | unicode-display_width (1.6.1)
206 | warden (1.2.8)
207 | rack (>= 2.0.6)
208 | web-console (3.7.0)
209 | actionview (>= 5.0)
210 | activemodel (>= 5.0)
211 | bindex (>= 0.4.0)
212 | railties (>= 5.0)
213 | websocket-driver (0.7.1)
214 | websocket-extensions (>= 0.1.0)
215 | websocket-extensions (0.1.5)
216 |
217 | PLATFORMS
218 | ruby
219 | x64-mingw32
220 |
221 | DEPENDENCIES
222 | bootsnap (>= 1.1.0)
223 | byebug
224 | coffee-rails (~> 4.2)
225 | devise
226 | jbuilder (~> 2.5)
227 | listen (>= 3.0.5, < 3.2)
228 | pg (>= 0.18, < 2.0)
229 | puma (~> 3.12)
230 | rails (~> 5.2.4)
231 | rspec
232 | rubocop
233 | sass-rails (~> 5.0)
234 | spring
235 | spring-watcher-listen (~> 2.0.0)
236 | turbolinks (~> 5)
237 | tzinfo-data
238 | uglifier (>= 1.3.0)
239 | web-console (>= 3.3.0)
240 |
241 | RUBY VERSION
242 | ruby 2.7.0p0
243 |
244 | BUNDLED WITH
245 | 2.1.2
246 |
--------------------------------------------------------------------------------
/config/initializers/devise.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Use this hook to configure devise mailer, warden hooks and so forth.
4 | # Many of these configuration options can be set straight in your model.
5 | Devise.setup do |config|
6 | # The secret key used by Devise. Devise uses this key to generate
7 | # random tokens. Changing this key will render invalid all existing
8 | # confirmation, reset password and unlock tokens in the database.
9 | # Devise will use the `secret_key_base` as its `secret_key`
10 | # by default. You can change it below and use your own secret key.
11 | # config.secret_key = '67b47cf7eb7cd1b67d9057fd21fcbfbae6aebc2d4942449010ff41764e611cc93640784e5a674c21fd1c48017cf0e41a64e2d5f4030e4b7d3fedb425189e5cb6'
12 |
13 | # ==> Controller configuration
14 | # Configure the parent class to the devise controllers.
15 | # config.parent_controller = 'DeviseController'
16 |
17 | # ==> Mailer Configuration
18 | # Configure the e-mail address which will be shown in Devise::Mailer,
19 | # note that it will be overwritten if you use your own mailer class
20 | # with default "from" parameter.
21 | config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
22 |
23 | # Configure the class responsible to send e-mails.
24 | # config.mailer = 'Devise::Mailer'
25 |
26 | # Configure the parent class responsible to send e-mails.
27 | # config.parent_mailer = 'ActionMailer::Base'
28 |
29 | # ==> ORM configuration
30 | # Load and configure the ORM. Supports :active_record (default) and
31 | # :mongoid (bson_ext recommended) by default. Other ORMs may be
32 | # available as additional gems.
33 | require 'devise/orm/active_record'
34 |
35 | # ==> Configuration for any authentication mechanism
36 | # Configure which keys are used when authenticating a user. The default is
37 | # just :email. You can configure it to use [:username, :subdomain], so for
38 | # authenticating a user, both parameters are required. Remember that those
39 | # parameters are used only when authenticating and not when retrieving from
40 | # session. If you need permissions, you should implement that in a before filter.
41 | # You can also supply a hash where the value is a boolean determining whether
42 | # or not authentication should be aborted when the value is not present.
43 | # config.authentication_keys = [:email]
44 |
45 | # Configure parameters from the request object used for authentication. Each entry
46 | # given should be a request method and it will automatically be passed to the
47 | # find_for_authentication method and considered in your model lookup. For instance,
48 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
49 | # The same considerations mentioned for authentication_keys also apply to request_keys.
50 | # config.request_keys = []
51 |
52 | # Configure which authentication keys should be case-insensitive.
53 | # These keys will be downcased upon creating or modifying a user and when used
54 | # to authenticate or find a user. Default is :email.
55 | config.case_insensitive_keys = [:email]
56 |
57 | # Configure which authentication keys should have whitespace stripped.
58 | # These keys will have whitespace before and after removed upon creating or
59 | # modifying a user and when used to authenticate or find a user. Default is :email.
60 | config.strip_whitespace_keys = [:email]
61 |
62 | # Tell if authentication through request.params is enabled. True by default.
63 | # It can be set to an array that will enable params authentication only for the
64 | # given strategies, for example, `config.params_authenticatable = [:database]` will
65 | # enable it only for database (email + password) authentication.
66 | # config.params_authenticatable = true
67 |
68 | # Tell if authentication through HTTP Auth is enabled. False by default.
69 | # It can be set to an array that will enable http authentication only for the
70 | # given strategies, for example, `config.http_authenticatable = [:database]` will
71 | # enable it only for database authentication. The supported strategies are:
72 | # :database = Support basic authentication with authentication key + password
73 | # config.http_authenticatable = false
74 |
75 | # If 401 status code should be returned for AJAX requests. True by default.
76 | # config.http_authenticatable_on_xhr = true
77 |
78 | # The realm used in Http Basic Authentication. 'Application' by default.
79 | # config.http_authentication_realm = 'Application'
80 |
81 | # It will change confirmation, password recovery and other workflows
82 | # to behave the same regardless if the e-mail provided was right or wrong.
83 | # Does not affect registerable.
84 | # config.paranoid = true
85 |
86 | # By default Devise will store the user in session. You can skip storage for
87 | # particular strategies by setting this option.
88 | # Notice that if you are skipping storage for all authentication paths, you
89 | # may want to disable generating routes to Devise's sessions controller by
90 | # passing skip: :sessions to `devise_for` in your config/routes.rb
91 | config.skip_session_storage = [:http_auth]
92 |
93 | # By default, Devise cleans up the CSRF token on authentication to
94 | # avoid CSRF token fixation attacks. This means that, when using AJAX
95 | # requests for sign in and sign up, you need to get a new CSRF token
96 | # from the server. You can disable this option at your own risk.
97 | # config.clean_up_csrf_token_on_authentication = true
98 |
99 | # When false, Devise will not attempt to reload routes on eager load.
100 | # This can reduce the time taken to boot the app but if your application
101 | # requires the Devise mappings to be loaded during boot time the application
102 | # won't boot properly.
103 | # config.reload_routes = true
104 |
105 | # ==> Configuration for :database_authenticatable
106 | # For bcrypt, this is the cost for hashing the password and defaults to 11. If
107 | # using other algorithms, it sets how many times you want the password to be hashed.
108 | #
109 | # Limiting the stretches to just one in testing will increase the performance of
110 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
111 | # a value less than 10 in other environments. Note that, for bcrypt (the default
112 | # algorithm), the cost increases exponentially with the number of stretches (e.g.
113 | # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
114 | config.stretches = Rails.env.test? ? 1 : 11
115 |
116 | # Set up a pepper to generate the hashed password.
117 | # config.pepper = 'd8638a186698ce5ee22d24022513dfb587f4220babda3b803e311474e8c2c8a4e2529e1c88ddd92963fedad1eb840a442c29c6b8a5c948986287ae4f58b810ec'
118 |
119 | # Send a notification to the original email when the user's email is changed.
120 | # config.send_email_changed_notification = false
121 |
122 | # Send a notification email when the user's password is changed.
123 | # config.send_password_change_notification = false
124 |
125 | # ==> Configuration for :confirmable
126 | # A period that the user is allowed to access the website even without
127 | # confirming their account. For instance, if set to 2.days, the user will be
128 | # able to access the website for two days without confirming their account,
129 | # access will be blocked just in the third day.
130 | # You can also set it to nil, which will allow the user to access the website
131 | # without confirming their account.
132 | # Default is 0.days, meaning the user cannot access the website without
133 | # confirming their account.
134 | # config.allow_unconfirmed_access_for = 2.days
135 |
136 | # A period that the user is allowed to confirm their account before their
137 | # token becomes invalid. For example, if set to 3.days, the user can confirm
138 | # their account within 3 days after the mail was sent, but on the fourth day
139 | # their account can't be confirmed with the token any more.
140 | # Default is nil, meaning there is no restriction on how long a user can take
141 | # before confirming their account.
142 | # config.confirm_within = 3.days
143 |
144 | # If true, requires any email changes to be confirmed (exactly the same way as
145 | # initial account confirmation) to be applied. Requires additional unconfirmed_email
146 | # db field (see migrations). Until confirmed, new email is stored in
147 | # unconfirmed_email column, and copied to email column on successful confirmation.
148 | config.reconfirmable = true
149 |
150 | # Defines which key will be used when confirming an account
151 | # config.confirmation_keys = [:email]
152 |
153 | # ==> Configuration for :rememberable
154 | # The time the user will be remembered without asking for credentials again.
155 | # config.remember_for = 2.weeks
156 |
157 | # Invalidates all the remember me tokens when the user signs out.
158 | config.expire_all_remember_me_on_sign_out = true
159 |
160 | # If true, extends the user's remember period when remembered via cookie.
161 | # config.extend_remember_period = false
162 |
163 | # Options to be passed to the created cookie. For instance, you can set
164 | # secure: true in order to force SSL only cookies.
165 | # config.rememberable_options = {}
166 |
167 | # ==> Configuration for :validatable
168 | # Range for password length.
169 | config.password_length = 6..128
170 |
171 | # Email regex used to validate email formats. It simply asserts that
172 | # one (and only one) @ exists in the given string. This is mainly
173 | # to give user feedback and not to assert the e-mail validity.
174 | config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
175 |
176 | # ==> Configuration for :timeoutable
177 | # The time you want to timeout the user session without activity. After this
178 | # time the user will be asked for credentials again. Default is 30 minutes.
179 | # config.timeout_in = 30.minutes
180 |
181 | # ==> Configuration for :lockable
182 | # Defines which strategy will be used to lock an account.
183 | # :failed_attempts = Locks an account after a number of failed attempts to sign in.
184 | # :none = No lock strategy. You should handle locking by yourself.
185 | # config.lock_strategy = :failed_attempts
186 |
187 | # Defines which key will be used when locking and unlocking an account
188 | # config.unlock_keys = [:email]
189 |
190 | # Defines which strategy will be used to unlock an account.
191 | # :email = Sends an unlock link to the user email
192 | # :time = Re-enables login after a certain amount of time (see :unlock_in below)
193 | # :both = Enables both strategies
194 | # :none = No unlock strategy. You should handle unlocking by yourself.
195 | # config.unlock_strategy = :both
196 |
197 | # Number of authentication tries before locking an account if lock_strategy
198 | # is failed attempts.
199 | # config.maximum_attempts = 20
200 |
201 | # Time interval to unlock the account if :time is enabled as unlock_strategy.
202 | # config.unlock_in = 1.hour
203 |
204 | # Warn on the last attempt before the account is locked.
205 | # config.last_attempt_warning = true
206 |
207 | # ==> Configuration for :recoverable
208 | #
209 | # Defines which key will be used when recovering the password for an account
210 | # config.reset_password_keys = [:email]
211 |
212 | # Time interval you can reset your password with a reset password key.
213 | # Don't put a too small interval or your users won't have the time to
214 | # change their passwords.
215 | config.reset_password_within = 6.hours
216 |
217 | # When set to false, does not sign a user in automatically after their password is
218 | # reset. Defaults to true, so a user is signed in automatically after a reset.
219 | # config.sign_in_after_reset_password = true
220 |
221 | # ==> Configuration for :encryptable
222 | # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
223 | # You can use :sha1, :sha512 or algorithms from others authentication tools as
224 | # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
225 | # for default behavior) and :restful_authentication_sha1 (then you should set
226 | # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
227 | #
228 | # Require the `devise-encryptable` gem when using anything other than bcrypt
229 | # config.encryptor = :sha512
230 |
231 | # ==> Scopes configuration
232 | # Turn scoped views on. Before rendering "sessions/new", it will first check for
233 | # "users/sessions/new". It's turned off by default because it's slower if you
234 | # are using only default views.
235 | # config.scoped_views = false
236 |
237 | # Configure the default scope given to Warden. By default it's the first
238 | # devise role declared in your routes (usually :user).
239 | # config.default_scope = :user
240 |
241 | # Set this configuration to false if you want /users/sign_out to sign out
242 | # only the current scope. By default, Devise signs out all scopes.
243 | # config.sign_out_all_scopes = true
244 |
245 | # ==> Navigation configuration
246 | # Lists the formats that should be treated as navigational. Formats like
247 | # :html, should redirect to the sign in page when the user does not have
248 | # access, but formats like :xml or :json, should return 401.
249 | #
250 | # If you have any extra navigational formats, like :iphone or :mobile, you
251 | # should add them to the navigational formats lists.
252 | #
253 | # The "*/*" below is required to match Internet Explorer requests.
254 | # config.navigational_formats = ['*/*', :html]
255 |
256 | # The default HTTP method used to sign out a resource. Default is :delete.
257 | config.sign_out_via = :delete
258 |
259 | # ==> OmniAuth
260 | # Add a new OmniAuth provider. Check the wiki for more information on setting
261 | # up on your models and hooks.
262 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
263 |
264 | # ==> Warden configuration
265 | # If you want to use other strategies, that are not supported by Devise, or
266 | # change the failure app, you can configure them inside the config.warden block.
267 | #
268 | # config.warden do |manager|
269 | # manager.intercept_401 = false
270 | # manager.default_strategies(scope: :user).unshift :some_external_strategy
271 | # end
272 |
273 | # ==> Mountable engine configurations
274 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine
275 | # is mountable, there are some extra configurations to be taken into account.
276 | # The following options are available, assuming the engine is mounted as:
277 | #
278 | # mount MyEngine, at: '/my_engine'
279 | #
280 | # The router that invoked `devise_for`, in the example above, would be:
281 | # config.router_name = :my_engine
282 | #
283 | # When using OmniAuth, Devise cannot automatically set OmniAuth path,
284 | # so you need to do it manually. For the users scope, it would be:
285 | # config.omniauth_path_prefix = '/my_engine/users/auth'
286 |
287 | # ==> Turbolinks configuration
288 | # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly:
289 | #
290 | # ActiveSupport.on_load(:devise_failure_app) do
291 | # include Turbolinks::Controller
292 | # end
293 |
294 | # ==> Configuration for :registerable
295 |
296 | # When set to false, does not sign a user in automatically after their password is
297 | # changed. Defaults to true, so a user is signed in automatically after changing a password.
298 | # config.sign_in_after_change_password = true
299 | end
300 |
--------------------------------------------------------------------------------
3 | <%= comment.user.name %>: <%= comment.content %> 4 |
5 | <%= comment.created_at.strftime("%Y/%m/%d") %> 6 |