Skip to content

Ruby On Rails

Yuqi Wu edited this page Sep 7, 2016 · 4 revisions

database.yml

  • & -- means alias.
  • << -- means insert some content here.
    • -- means reference a node by its alias.
defaults: &def  # alias def
  ...
test:
  <<: *def  # insert the default (by its alias) node content here.

Server Mode, production, test, development.

rails s -e production / test / development -p 3000

ActiveRecord

An Object/Relational Mapping (ORM) layer supplied with Rails. It closely follows the standard ORM model, which is as follows −

  • tables map to classes
  • rows map to objects and
  • columns map to object attributes

  • An error occurred while installing eventmachine (1.0.3)
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/austin/.rvm/rubies/ruby-2.1.5/bin/ruby -r ./siteconf20160907-67417-10a02jl.rb extconf.rb 
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_enable_interrupt()... no
checking for rb_time_new()... yes
checking for sys/event.h... yes
checking for sys/queue.h... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling binder.cpp
In file included from binder.cpp:20:
./project.h:107:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
         ^
1 error generated.
make: *** [binder.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/austin/.rvm/gems/ruby-2.1.5/gems/eventmachine-1.0.3 for inspection.
Results logged to /Users/austin/.rvm/gems/ruby-2.1.5/extensions/x86_64-darwin-14/2.1.0-static/eventmachine-1.0.3/gem_make.out
An error occurred while installing eventmachine (1.0.3), and Bundler cannot
continue.

This is coused by, the bundle can not find system openssl, or it does not use system openssl, so add flags when gem install as follow, gem install eventmachine -- --with-cppflags=-I/usr/local/opt/openssl/include or bundle config build.eventmachine --with-cppflags=-I/usr/local/opt/openssl/include | bundle install

Clone this wiki locally