Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 4

Rails

~ CRUD ~

Rails
Windows http://railsinstaller.org/ Mac http://railsoneclick.com/ Linux Ruby, Ruby Gems gem install rails

rails new rails new keijiban rails new [] keijiban * SQLite3 mysql -d=mysql http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#table:rails_directory_structure File/Direct ory app/ Purpose Core application (app) code, including models, views, controllers, and helpers Rails Applications assets such as cascading style sheets (CSS), JavaScript files, and images JavaScript, CSS Application configuration Database files

app/assets

config/ db/

doc/ lib/ lib/assets log/ public/ script/rails test/ tmp/ vendor/ vendor/asse ts README.rd oc Rakefile Gemfile Gemfile.loc k config.ru .gitignore

Documentation for the application Library modules Library assets such as cascading style sheets (CSS), JavaScript files, and images Application log files Data accessible to the public (e.g., web browsers), such as error pages A script for generating code, opening console sessions, or starting a local server Application tests (made obsolete by the spec/ directory in Section 3.1.2) Temporary files Third-party code such as plugins and gems Third-party assets such as cascading style sheets (CSS), JavaScript files, and images A brief description of the application Utility tasks available via the rake command Gem requirements for this app A list of gems used to ensure that all copies of the app use the same gem versions A configuration file for Rack middleware Patterns for files that should be ignored by Git

cd keijiban rails s s server rails server OK

http://localhost:3000/

http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#fig:riding_rails_31 OK Ctrl + c

CRUD
rails g scaffold rails g scaffold posts content rails g scaffold [] [] * g generate g generate app/controllers/posts_controller.rb app/models/post.rb app/views/posts db/migrate/20_create_posts.rb

DB rake db:migrate posts rails s migration http://localhost:3000/posts Listing posts OK createeditshowdestroy

You might also like