8000 GitHub - Tosbaba1/capstone
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Tosbaba1/capstone

 
 

Repository files navigation

Rails Template

This is a base Ruby on Rails repository configured for learning with Codespaces (and Gitpod).

  • Ruby version: 3.2.1
  • Rails version: 7.1.3.3

We've added additional Ruby gems and other software that aren't automatically available in a new Rails app, and configured

UJS and Turbo

In Rails version 7, support for Unobtrusive JavaScript (UJS) is not the default. Rather, this has been replaced with Turbo.

However, in AppDev, we typically want to first demonstrate UJS and then enable Turbo manually when we want it.

Therefore, UJS has been pre-configured here with these steps:

  • Pin UJS + jQuery in config/importmap.rb by running:

    % ./bin/importmap pin @rails/ujs
    % ./bin/importmap pin jquery
    
  • Add UJS + jQuery via:

    // app/javascript/application.js
    import jquery from "jquery";
    window.jQuery = jquery;
    window.$ = jquery;
    import Rails from "@rails/ujs"
    Rails.start();

UJS and Turbo can co-exist side-by-side with these instructions, which we already implemented here.

By default, Turbo is disabled via:

// app/javascript/application.js
import { Turbo } from "@hotwired/turbo-rails"
Turbo.session.drive = false

Set it to true to enable Turbo everywhere, or you can use data-turbo="true" to enable Drive on a per-element basis while leaving it globally false.

Additional gems:

Additional software:

  • OS Ubuntu 20.04.5 LTS
  • Chromedriver
  • Fly.io's flyctl
  • Google Chrome (headless browser)
  • Graphviz
  • Node JS 18
  • NPM 8.19.3
  • Postgresql 12
  • Redis
  • Yarn

VS Code extensions:

  • vortizhe.simple-ruby-erb
  • mbessey.vscode-rufo
  • aliariff.vscode-erb-beautify
  • eamodio.gitlens
  • setobiralo.erb-commenter

Development Setup

Run the database migrations before loading sample data:

bundle install
rails db:create db:migrate
rake sample_data

Ensure that an OPENAI_API_KEY environment variable is set with your OpenAI API key for librarian chat features.

If you see an error like Errno::ENOENT @ rb_sysopen - 0.0.0.0 when submitting a question to the librarian chat, double check that OPENAI_API_KEY is pointing to your actual API key value and not a placeholder such as 0.0.0.0.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 64.4%
  • HTML 29.3%
  • Dockerfile 2.9%
  • JavaScript 1.3%
  • SCSS 0.8%
  • CSS 0.8%
  • Shell 0.5%
0