Coder Social home page Coder Social logo

vkvikaskmr / rails7_demo_by_dhh Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 35 KB

DHH showing how to build a responsive web app. In this app we see how we can create a post page where any edit to the post, updates everybody's screen who are on that post page. Similarly, comments made on the post get added to the page asynchronously without any page refresh

Ruby 72.46% JavaScript 3.36% CSS 2.44% SCSS 1.59% HTML 20.15%

rails7_demo_by_dhh's Introduction

README

Rails 7 code along with DHH.(using bootstrap)

  • Some notes from the sessions:

    • How to download JS package and pin it in importmaps
      # download package
      ./bin/importmap pin local-time --download # this downloads it in the vendor file
      
    • How to pin JS package in importmap using the jspm CDN
      ./bin/importmap pin local-time
      
  • WIP

    • Active storage not working with turbo streams. Need to check I was able to figure this out. Need to add default_url_options in the config. See this commit
  • Intalling bootstrap with rails 7 and importmaps. Found the simplest version which works with the default rails setup - sprockets and importmaps.

    • install bootstrap and sassc-rails gems in your broject
    • rename app/assets/stylesheets.css to app/assets/stylesheets.scss
    • add line @import "bootstrap"; to the application.scss file
    • then open config/initializers/assets.rb and add these line
    Rails.application.config.assets.precompile += %w( bootstrap.min.js popper.js )
    
    • goto config/importmap.rb and add the following lines
    pin "popper", to: 'popper.js', preload: true
    pin "bootstrap", to: 'bootstrap.min.js', preload: true
    
    • goto app/javascript/application.js and add following lines
    import "popper"
    import "bootstrap"
    
  • Install Redis (for turbo-stream to work)

    sudo apt update
    sudo apt install redis-server
    sudo service redis-server start
    # test installation using
    redis-cli ping
    
  • Install postgres from here: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-20-04

  • Using active storage requires some extra setup

    # this is used by image-processing gem
    sudo apt install libvips42
    
  • Install rbenv

    • sudo apt update
    • sudo apt install git curl libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev
    • curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
    • echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
    • echo 'eval "$(rbenv init -)"' >> ~/.bashrc
    • source ~/.bashrc

rails7_demo_by_dhh's People

Contributors

vkvikaskmr avatar

Stargazers

Sri avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.