RubyOnRails: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
(Die Seite wurde neu angelegt: „Kategorie:Framework = Installation = <pre>apt-get install ruby ruby-rails nodejs ruby-sqlite3 \ ruby-spring ruby-sass-rails ruby-uglifier ruby-coffee-rai…“) |
K |
||
(3 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
[[Kategorie:Framework]] | [[Kategorie:Framework]] | ||
= Installation = | = Installation = | ||
<pre>apt-get install ruby ruby-rails nodejs ruby-sqlite3 \ | <pre>apt-get install ruby ruby-dev ruby-rails nodejs ruby-sqlite3 \ | ||
ruby-spring ruby-sass-rails ruby-uglifier ruby-coffee-rails \ | ruby-spring ruby-sass-rails ruby-uglifier ruby-coffee-rails \ | ||
ruby-jquery-rails ruby-turbolinks ruby-jquery-turbolinks \ | ruby-jquery-rails ruby-turbolinks ruby-jquery-turbolinks \ | ||
ruby-jbuilder ruby-sdoc ruby-byebug ruby-web-console | ruby-jbuilder ruby-sdoc ruby-byebug ruby-web-console libpq-dev | ||
gem install pg | |||
</pre> | </pre> | ||
Zeile 10: | Zeile 11: | ||
<pre>BASE=/home/ws/ruby | <pre>BASE=/home/ws/ruby | ||
cd $BASE | cd $BASE | ||
rails new | rails new rdbman | ||
BASE=/home/ws/ruby/rdbman | |||
cd $BASE/config | |||
# Anpassen database.yml | |||
cd $BASE/script | |||
</pre> | |||
== Rails-Kommandos == | |||
<pre>rails generate model Database | |||
rails generate model Owner | |||
# anpassen app/models/database.rb + owner.rb | |||
rails generate migration databases | |||
rails generate migration owners | |||
</pre> | |||
== Beispiel $BASE/config/database.yml == | |||
vi database.yml | |||
<pre> | |||
default: &default | |||
adapter: postgresql | |||
encoding: unicode | |||
development: | |||
adapter: postgresql | |||
encoding: unicode | |||
database: rdbman_development | |||
username: rubydba | |||
password: Geheim | |||
test: | |||
adapter: postgresql | |||
encoding: unicode | |||
database: rdbman_test | |||
username: rubydba | |||
password: Geheim | |||
production: | |||
adapter: postgresql | |||
encoding: unicode | |||
database: rdbman_production | |||
username: rubydba | |||
password: Geheim | |||
</pre> | </pre> |
Aktuelle Version vom 17. Februar 2017, 21:14 Uhr
Installation[Bearbeiten]
apt-get install ruby ruby-dev ruby-rails nodejs ruby-sqlite3 \ ruby-spring ruby-sass-rails ruby-uglifier ruby-coffee-rails \ ruby-jquery-rails ruby-turbolinks ruby-jquery-turbolinks \ ruby-jbuilder ruby-sdoc ruby-byebug ruby-web-console libpq-dev gem install pg
Neues Projekt[Bearbeiten]
BASE=/home/ws/ruby cd $BASE rails new rdbman BASE=/home/ws/ruby/rdbman cd $BASE/config # Anpassen database.yml cd $BASE/script
Rails-Kommandos[Bearbeiten]
rails generate model Database rails generate model Owner # anpassen app/models/database.rb + owner.rb rails generate migration databases rails generate migration owners
Beispiel $BASE/config/database.yml[Bearbeiten]
vi database.yml
default: &default adapter: postgresql encoding: unicode development: adapter: postgresql encoding: unicode database: rdbman_development username: rubydba password: Geheim test: adapter: postgresql encoding: unicode database: rdbman_test username: rubydba password: Geheim production: adapter: postgresql encoding: unicode database: rdbman_production username: rubydba password: Geheim