Skip to content

Instantly share code, notes, and snippets.

@GALTdea
GALTdea / CONVENTIONS.md
Created February 12, 2025 18:41 — forked from peterc/CONVENTIONS.md
CONVENTIONS.md file for AI Rails 8 development
  • You MUST NOT try and generate a Rails app from scratch on your own by generating each file. For a NEW app you MUST use rails new first to generate all of the boilerplate files necessary.
  • Create an app in the current directory with rails new .
  • Use Tailwind CSS for styling. Use --css tailwind as an option on the rails new call to do this automatically.
  • Use Ruby 3.2+ and Rails 8.0+ practices.
  • Use the default Minitest approach for testing, do not use RSpec.
  • Default to using SQLite in development. rails new will do this automatically but take care if you write any custom SQL that it is SQLite compatible.
  • An app can be built with a devcontainer such as rails new myapp --devcontainer but only do this if requested directly.
  • Rails apps have a lot of directories to consider, such as app, config, db, etc.
  • Adhere to MVC conventions: singular model names (e.g., Product) map to plural tables (products); controllers are plural.
  • Guard against incapable browsers accessing controllers with `allo
@GALTdea
GALTdea / ds_and_algos.md
Created July 5, 2022 21:04 — forked from iscott/ds_and_algos.md
Intro to Datastructures and Algorithms Cheat Sheet
@GALTdea
GALTdea / index.html
Created July 4, 2021 00:12 — forked from labnol/index.html
A textbox that looks like a notepad! Forms are fun!
<div id="wrapper">
<form id="paper" method="get" action="">
<div id="margin">Title: <input id="title" type="text" name="title"></div>
<textarea placeholder="Enter something funny." id="text" name="text" rows="4" style="overflow: hidden; word-wrap: break-word; resize: none; height: 160px; "></textarea>
<br>
<input id="button" type="submit" value="Create">
</form>
</div>
@GALTdea
GALTdea / stimulus.md
Created July 15, 2020 01:47 — forked from mrmartineau/stimulus.md
Stimulus cheatsheet

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@GALTdea
GALTdea / vueSetup.md
Created September 28, 2019 00:44 — forked from nerdenough/vueSetup.md
macOS Setup for Vue

macOS setup for Vue

Install macOS :P

Install Homebrew

Open terminal and run the follow command to install the latest version of Homebrew. This will also install the XCode utils if you don't have them already installed.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@GALTdea
GALTdea / rails_generator_cheat_sheet.md
Created August 11, 2019 05:09 — forked from cdesch/rails_generator_cheat_sheet.md
Rails Generator CheatSheet

Cheat Sheets are greate but they are not a substitute for learning the framework and reading the documentation as we most certainly have not covered every potential example here. Please refer to the Rails Command Line Docs for more information.

Command Line Generator Info

Reference

You can get all of this information on the command line.

rails generate with no generator name will output a list of all available generators and some information about global options. rails generate GENERATOR --help will list the options that can be passed to the specified generator.

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

@GALTdea
GALTdea / mysql.database.yml
Created April 8, 2017 00:15 — forked from jwo/mysql.database.yml
Sample config/database.yml from Rails. Postgres, MySQL, and SQLite
#
# Install the MYSQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
@GALTdea
GALTdea / rails-postgres-backbone-bootstrap-bootswatch
Created April 7, 2017 23:07 — forked from sionc/rails-postgres-backbone-bootstrap-bootswatch
Instructions on creating a new app using Ruby on Rails, Postgresql, Backbone.js, Twitter Boostrap, Bootstwatch
- Check rails version
$ rails -v
- To update rails
$ gem update rails
- Creating a new rails app using postgresql
$ mkdir rails_projects
$ cd rails_projects
$ rails new myapp --database=postgresql