ALL HOW TOs




Naming Conventions

Name for

convention

example

other generated files

project names

all lower case with words separated by underscore

my_project (ROOT)

lot of directories

engine namesall lower case with words separated by underscoremy_enginesimilar to projects + test dir with dummy app that includes the engine, used for testing.

database names

all lower case with words separated by underscore

my_database


controller

all lower case with words separated by underscore

app/controllers/data_set_controller.rb

views/data_set directory

views

all lower case with words separated by underscore

app/views/data_set/show_list.html.erb


model names

CamelCase singular

app/model/data_set.rb
with class DataSet

table in database: data_sets (plural)
db/migrate/20130101000000_create_data_sets.rb
with class: CreateDataSets

method namesPreferred:  all lower case with words separated by underscoremy_method
OK: first char lower case, all others in a..z, A..Z, 0..9, _myMethod
local variablePreferred:  all lower case with words separated by underscoremy_variable
OK: first char lower case, all others in a..z, A..Z, 0..9, _myVariable
instance variableSame as local variable, but starts with @@my_instance_variable
class variableSame as local variable, but starts with @@@@my_class_variable
global variableSame as local variable, but starts with $$my_global_variable
constantPreferred: all upper case with words separated by underscoreMY_CONSTANT

OK: first character upper case, all others in a..z, A..Z, 0..9, _My_Constant


Directory Structure

directory

purpose

app/controllers/concerns

common code for all controllers

app/models/concerns

common code for all models

app/views/layouts

???

app/assets

images, css, etc. controlled by rails' asset pipeline

app/mailers

??? used with sending emails - not sure how

app/helpers

help with views

bin/bundle

bundle command

bin/rails

rails command

bin/rake

rake command

config/database.yml

configures database setup

config/routes.rb

configures url actions and what code is executed

config/application.rb

configure application

config/environment.rb

configure all environments

config/environments/*.rb

configure development, test, and production specific configs

config/initializers

code that runs when app launches

db

database management files (e.g. rake merge files, etc.)

lib/assets

code libraries drawn into this app

lib/tasks

rake tasks written specifically for this app

public

anything in this folder is public


Ports

port

example use

usage description

notes

3000

http://localhost:3000 

rails webapp

for the project where the rails server was started

3306


MySql


5432
Postgres
8983http://localhost:8983 Hyrax - Solr (dev)use when running rails s internal app
8984http://localhost:8984 Hyrax - Fedora (dev)use when running rails s internal app
8985http://localhost:8985  Hyrax - Solr (test)use when running rspec tests
8986http://localhost:8986 Hyrax - Fedora (test)use when running rspec tests




  • No labels