Install this gem in the project
gem 'metamagic'
In layouts/application.html.erb file
<%=metamagic site: "InitCoders", title: [:title, :site], keywords: [:keywords, "keyword 1", "keyword 2"], description: "", separator: " - " %>
<?xml version="1.0" encoding="UTF-8"?> | |
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | |
<url> | |
<loc>http://example.com</loc> | |
<lastmod>2020-12-06T17:38:21+00:00</lastmod> | |
<priority>0.5</priority> | |
<changefreq>weekly</changefreq> | |
</url> | |
<url> | |
<loc>http://example.com/about</loc> |
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file | |
# | |
# To ban all spiders from the entire site uncomment the next two lines: | |
User-agent: * | |
Disallow: / |
# .github/workflows/ci.yml | |
name: CI | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:11 | |
ports: |
# frozen_string_literal: true | |
# 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 |
release: ./scripts/release-tasks.sh | |
web: bundle exec puma -C config/puma.rb | |
worker: bundle exec rake jobs:work |
require: | |
- rubocop-performance | |
- rubocop-rails | |
- rubocop-rspec | |
# AllCops: | |
# Rails: | |
# Enabled: true | |
Layout/EmptyLinesAroundAttributeAccessor: | |
Enabled: true |
# frozen_string_literal: true | |
# This file is copied to spec/ when you run 'rails generate rspec:install' | |
require 'spec_helper' | |
ENV['RAILS_ENV'] ||= 'test' | |
require File.expand_path('../config/environment', __dir__) | |
# 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 'capybara/rspec' |
Install this gem in the project
gem 'metamagic'
In layouts/application.html.erb file
<%=metamagic site: "InitCoders", title: [:title, :site], keywords: [:keywords, "keyword 1", "keyword 2"], description: "", separator: " - " %>
# Project API application controller module | |
class ApplicationController < ActionController::API | |
before_action :authorized | |
def encode_token(payload) | |
JWT.encode(payload, ENV['APP_SECRET_TOKEN']) | |
end | |
def auth_header | |
# { Authorization: 'Bearer <token>' } |
Use the below command to create "API Only" project.
rails new my_api_project --api
Install JWT Gem
gem 'jwt'