Ruby On Rails上手笔记(安装使用全过程)
来源:爱站网时间:2021-09-17编辑:网友分享
爱站技术小编在写Ruby On Rails上手笔记(安装使用全过程),有机会再试一试Rails了,只是原来接触的是2,现在已然变成了4,似乎现在的安装比原来会快些。具体的操作在下面已经写出来了,这份笔记很实用哦,建议大家收藏。
Rails 4 安装
针对于安装了RVM
复制代码 代码如下:
gem install rails
没有的话应该这样:
复制代码 代码如下:
sudo gem install rails
安装RVM可以用句
复制代码 代码如下:
curl -L https://get.rvm.io | bash -s stable
查看rails版本
似乎这就是诸如Django、Rails这类对于轻量级网站的数据库要求。
复制代码 代码如下:
brew install sqlite3
其他可以看情况安装,如openSUSE
复制代码 代码如下:
$rails new hello
于是就有了
复制代码 代码如下:
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/javascripts/application.js
create app/assets/stylesheets/application.css
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/views/layouts/application.html.erb
create app/assets/images/.keep
create app/mailers/.keep
create app/models/.keep
create app/controllers/concerns/.keep
create app/models/concerns/.keep
create bin
create bin/bundle
create bin/rails
create bin/rake
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/backtrace_silencers.rb
create config/initializers/filter_parameter_logging.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/secret_token.rb
create config/initializers/session_store.rb
create config/initializers/wrap_parameters.rb
create config/locales
create config/locales/en.yml
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create lib
create lib/tasks
create lib/tasks/.keep
create lib/assets
create lib/assets/.keep
create log
create log/.keep
create public
create public/404.html
create public/422.html
create public/500.html
create public/favicon.ico
create public/robots.txt
create test/fixtures
create test/fixtures/.keep
create test/controllers
create test/controllers/.keep
create test/mailers
create test/mailers/.keep
create test/models
create test/models/.keep
create test/helpers
create test/helpers/.keep
create test/integration
create test/integration/.keep
create test/test_helper.rb
create tmp/cache
create tmp/cache/assets
create vendor/assets/javascripts
create vendor/assets/javascripts/.keep
create vendor/assets/stylesheets
create vendor/assets/stylesheets/.keep
run bundle install
接着会安装包依赖
这样的话打开 http://localhost:3000 就可以看到,Rails的欢迎界面Welcome aboard,有点类似于Django-CMS的小马哥~~
如官方指南所说http://guides.rubyonrails.org/getting_started.html
复制代码 代码如下:
$rails generate controller welcome index
就会创建下面这些文件:
复制代码 代码如下:
root 'welcome#index'
再运行
以上内容就是爱站技术频道小编为大家分享的Ruby On Rails上手笔记(安装使用全过程),这份笔记内容经过不断修缮的,就为了让大家更加容易的懂,关注爱站吧,带你了解更多的干货。