Skip to content

krtb/my_rails_blog

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
app
 
 
bin
 
 
 
 
db
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

My Rails Blog

A blog to explore new rails features along with unit, functional, and integration testing Link to Live Site

Tech Stack

  • Front-End
    • Styling
      • SCSS / sass css
      • Bootstrap 4
  • Back-End
    • Framework
      • Rails
    • Package Management
      • NPM
      • YARN
      • Babel
      • Webpack
        • faster compilation with Foreman gem
          • to Start Foreman running process
            • foreman start -f Procfile.dev
    • Database
      • Postgress
    • Deployed On
      • Heroku
  • Testing
    • tbd

Issue & Solution Documentation

  • Issue #1
    • Missing app/assets/javascript/application.js folder/file in Rails 6
    • Slow render on compilation of SCSS
    • Solution #1
      • Medium Blog Post
      • use & configure Webpack
      • yarn add bootstrap@4.3.1 jquery popper.js
      • import only styles that are needed, not entire Node folder
      • Created
        • javascript/stylesheets fodler
          • application.scss
            • @import './bootstrap_custom.scss';
          • bootstrap_custom.scss
            • @import specific components
          • javascript/packs
            • application.js
              • import '../stylesheets/application'
              • import './bootstrap_custom.js'
            • bootstrap_custom.js
              • @import specific components
      • Layouts
        • application.html.erb file
          • <%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
          • <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
      • webpack/environment.js
          const webpack = require('webpack')
        environment.plugins.append(
            'Provide',
            new webpack.ProvidePlugin({
                $: 'jquery',
                jQuery: 'jquery',
                Popper: ['popper.js', 'default']
            })
        )
  • Issue #2
  • Issue #3
    • Connecting PostgreSQL DB with Rails application
    • Solution #3
      • Research
      • Implementation
        • in terminal, from app
        • rails db:setup
        • Explanation of Command
          • will create development and test databases
          • set owner to the user specified
          • create “schema_migrations” tables in each
          • table is used to record migrations to schemas and data
  • Issue #4
    • centering horizontal bootstrap4 columns
      • Solution #4
        • Research
        • Implementation
          • in partial form
          • <%= form_for @user, :html => {:class => "form-horizontal center"} do |f| %>...
          • in html of form
          • class="col-auto offset-sm-2"
          • Explanation
            • uses a flexbox utility to vertically center the contents and changes .col to .col-auto so that your columns only take up as much space as needed.
          • html structure
          • Explanation
            <!-- FIRST -->
            <div class="container" >
             
            <!-- SECOND -->
            <%= form_for(@article, :html => {class: "form-horizontal center", role: "form" }) do |f| %>
            <!-- THIRD -->
             <div class="control-label form-group row" >

            Bootstrap 4 Rows (from FreeCodeCamp article)

            • They have to be placed in containers.
            • They are only used for containing columns.
            • The columns have to be children of the row.
  • Issue #4
    • adding secure passwords for Users
    • Solution #4
      • ADD METHOD: has_secure_password method in model (user.rb)
      • ADD GEM: gem 'bcrypt' in Gemfile
      • ADD COLUMN: password_digest attribute in Users table
        • How does above mechanism work?
          1. takes password string that's entered
          2. creates one way hash digest of string, saves to database
          3. SALTS password, adding random data to password
          4. to authenticate users with salted password
            1. USE METHOD: resouce.authenticate('password') to compare passwords in DB

Resources

About

A blog to explore new Rails features along with unit, functional, and integration testing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages