rm public/index.html
次にトップページを作ります。
$ rails g controller top index
create app/controllers/top_controller.rb
route get "top/index"
invoke erb create app/views/top
create app/views/top/index.html.erb
invoke test_unit
create test/functional/top_controller_test.rb
invoke helper create app/helpers/top_helper.rb
invoke test_unit
create test/unit/helpers/top_helper_test.rb
invoke assets
invoke coffee
create app/assets/javascripts/top.js.coffee
invoke scss create app/assets/stylesheets/top.css.scss
おっとその前にプッシュしちゃいけないのを設定し忘れてました。
create app/controllers/top_controller.rb
route get "top/index"
invoke erb create app/views/top
create app/views/top/index.html.erb
invoke test_unit
create test/functional/top_controller_test.rb
invoke helper create app/helpers/top_helper.rb
invoke test_unit
create test/unit/helpers/top_helper_test.rb
invoke assets
invoke coffee
create app/assets/javascripts/top.js.coffee
invoke scss create app/assets/stylesheets/top.css.scss
$ vi .gitignore
すでにあるのでそれを以下の内容で編集します。
# See http://help.github.com/ignore-files/ for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile ~/.gitignore_global
# Ignore bundler config
/.bundle
# Ignore the default SQLite database.
db/schema.rb
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
config/database.yml
.git
.rvmrc
.project
nbproject
Planets::Application.routes.draw do
root :to => "top#index"
end
次にAPIのHP作るなら作るはずであるお知らせを作ります。
root :to => "top#index"
end
rails g controller announcements index
create app/controllers/announcements_controller.rb
route get "announcements/index"
invoke erb
create app/views/announcements
create app/views/announcements/index.html.erb
invoke test_unit
create test/functional/announcements_controller_test.rb
invoke helper
create app/helpers/announcements_helper.rb
invoke test_unit
create test/unit/helpers/announcements_helper_test.rb
invoke assets
invoke coffee
create app/assets/javascripts/announcements.js.coffee
invoke scss
create app/assets/stylesheets/announcements.css.scss
続いてモデルも作成します。
create app/controllers/announcements_controller.rb
route get "announcements/index"
invoke erb
create app/views/announcements
create app/views/announcements/index.html.erb
invoke test_unit
create test/functional/announcements_controller_test.rb
invoke helper
create app/helpers/announcements_helper.rb
invoke test_unit
create test/unit/helpers/announcements_helper_test.rb
invoke assets
invoke coffee
create app/assets/javascripts/announcements.js.coffee
invoke scss
create app/assets/stylesheets/announcements.css.scss
$ rails g model announement
create db/migrate/20120427050622_create_announcements.rb
create app/models/announcement.rb
invoke test_unit
create test/unit/announcement_test.rb
create test/fixtures/announcements.yml
Gemファイルを変更します。以下を追加して「sqlite3」を削除します。
create db/migrate/20120427050622_create_announcements.rb
create app/models/announcement.rb
invoke test_unit
create test/unit/announcement_test.rb
create test/fixtures/announcements.yml
gem 'mysql2'
インストールします。
$ bundle install
database.ymlを変えます。
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: planets_development
pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
test:
adapter: mysql2
encoding: utf8
reconnect: false
database: planets_test
pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: planets_production
pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
そして最後セットアップです
adapter: mysql2
encoding: utf8
reconnect: false
database: planets_development
pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
test:
adapter: mysql2
encoding: utf8
reconnect: false
database: planets_test
pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: planets_production
pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
$ rake db:create
何も出なければ完了です。
0 件のコメント:
コメントを投稿