...
Expand | ||
---|---|---|
| ||
|
...
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 names | all lower case with words separated by underscore | my_engine | similar 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 | table in database: data_sets (plural) |
method names | Preferred: all lower case with words separated by underscore | my_method | |
OK: first char lower case, all others in a..z, A..Z, 0..9, _ | myMethod | ||
local variable | Preferred: all lower case with words separated by underscore | my_variable | |
OK: first char lower case, all others in a..z, A..Z, 0..9, _ | myVariable | ||
instance variable | Same as local variable, but starts with @ | @my_instance_variable | |
class variable | Same as local variable, but starts with @@ | @@my_class_variable | |
global variable | Same as local variable, but starts with $ | $my_global_variable | |
constant | Preferred: all upper case with words separated by underscore | MY_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 | rails webapp | for the project where the rails server was started | |
3306 | MySql | ||
5432 | Postgres | ||
8983 | http://localhost:8983 | Hyrax - Solr (dev) | use when running rails s internal app |
8984 | http://localhost:8984 | Hyrax - Fedora (dev) | use when running rails s internal app |
8985 | http://localhost:8985 | Hyrax - Solr (test) | use when running rspec tests |
8986 | http://localhost:8986 | Hyrax - Fedora (test) | use when running rspec tests |
...