get.rvm.io | bash -s stable 查看rails版本号 rails -v Rails 4.0.3 似乎这就是当前的最新版本号 Ruby版本号 We recommend...Ruby 2.1.0 for use with Rails....We stopped supporting Ruby 1.8.x after Rails 3.2. Ruby 1.9.2+ will be supported until Rails 5....welcome index 就会创建以下这些文件(Ruby On Rails 4 hello world,Ruby On Rails上手) create app/controllers/welcome_controller.rb...welcome.js.coffee invoke scss create app/assets/stylesheets/welcome.css.scss 在config/routes.rb加入�默认页面 root
@h202 ruby]# ls blog [root@h202 ruby]# cd blog/ [root@h202 blog]# ls app bin config config.ru db...#source 'https://rubygems.org' source 'https://gems.ruby-china.org/' [root@h202 blog]# 根据提示再次尝试安装 [...Installing coffee-rails 4.1.1 Installing jquery-rails 4.1.1 Using rails 4.2.6 Installing sass-rails...Post-install message from rdoc: Depending on your version of ruby, you may need to install ruby rdoc/...[root@h202 blog]# echo $? 0 [root@h202 blog]#
(Bundler::GemRequireError) 事实上我们系统里已经有了这个gem [root@h202 blog]# bundle list | grep uglifier * uglifier...JavaScript files by wrapping UglifyJS to be accessible in Ruby 解决方法是安装 NodeJS [root@h202 blog]# yum...[root@h202 blog]# 再次尝试 启动服务 [root@h202 blog]# rails server => Booting WEBrick => Rails 4.2.6 application...starting in development on http://localhost:3000 => Run `rails server -h` for more startup options =...> Ctrl-C to shutdown server [2016-04-22 13:28:17] INFO WEBrick 1.3.1 [2016-04-22 13:28:17] INFO ruby
Note: bundle install 过程中有一个警告,让我们不要使用 root,这样会让其它用户无法操作此应用,其实还有一定安全隐患,这里为图方便,只为了解功能就不去讲究这些了,生产环境下要非常注意...Don’t run Bundler as root....Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application...for all non-root users on this machine. ---- Rails 的目录结构 [root@h202 blog]# tree . ├── app │ ├── assets...└── views │ └── layouts │ └── application.html.erb ├── bin │ ├── bundle │ ├── rails
安装Rails 检查环境 检查以下三个软件,确保已经安装 [root@h202 ruby]# ruby -v ruby 2.3.0p0 (2015-12-25 revision 53290) [x86..._64-linux] [root@h202 ruby]# gem -v 2.5.1 [root@h202 ruby]# sqlite3 --version 3.6.20 [root@h202 ruby...https://gems.ruby-china.org/ [root@h202 ruby]# ---- 安装 Rails [root@h202 ruby]# gem install rails Fetching..., mime-types, mail, actionmailer, rails after 613 seconds 32 gems installed [root@h202 ruby]# echo $?...0 [root@h202 ruby]# rails --version Rails 4.2.6 [root@h202 ruby]#
sets of gems 是玩 ruby 不可多得的好工具 ---- 安装RVM [root@h202 ruby]# gpg --keyserver hkp://keys.gnupg.net --recv-keys...@h202 ruby]# echo $?...0 [root@h202 ruby]# curl -sSL https://get.rvm.io | bash -s stable Downloading https://github.com/rvm/...In case of problems: https://rvm.io/help and https://twitter.com/rvm_io [root@h202 ruby]# echo $?...0 [root@h202 ruby]#
查看可用ruby版本 [root@h202 ruby]# rvm list known -bash: rvm: command not found [root@h202 ruby]# su - root...[root@h202 ~]# cd ruby/ [root@h202 ruby]# rvm list known # MRI Rubies [ruby-]1.8.6[-p420] [ruby-]1.8.7...[root@h202 ruby]# ---- 安装ruby 接上版本号就可以自动安装指定版本的ruby [root@h202 ruby]# rvm install 2.3 Searching for binary...[root@h202 ruby]# echo $?...default # * - default [root@h202 ruby]# [root@h202 ruby]# ruby -v ruby 2.3.0p0 (2015-12-25 revision
前言 Rails 是使用 Ruby 语言编写的网页程序开发框架 通过为开发者提供常用组件,来简化网页程序的开发 Tip: 类似于 python 的 Django ,perl 的 Dancer Rails...our code is more maintainable, more extensible, and less buggy 约定优于配置 Convention Over Configuration: Rails...的相关基础,详细可以参考 官方文档 和 Ruby China 的 Rails 入门 Tip: 当前的最新版本为 Rails 5.0.0.beta3 发布于 February 27, 2016 4:00...pm ---- 概要 ---- 环境 [root@h202 ~]# cat /etc/issue CentOS release 6.6 (Final) Kernel \r on an \m [root...Linux h202 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux [root
bin/ 存放运行程序的 rails 脚本,以及其他用来部署或运行程序的脚本。 config/ 设置程序的路由,数据库等。详情参阅 “设置 Rails 程序” 一文。...任务在 Rails 的各组件中定义。如果想添加自己的任务,不要修改这个文件,把任务保存在 lib/tasks 文件夹中。 README.rdoc 程序的简单说明。...详情参阅 “测试 Rails 程序” 一文。 tmp/ 临时文件,例如缓存,PID,会话文件。 vendor/ 存放第三方代码。经常用来放第三方 gem。
409B6B1796C275462A1703113804BB82D39DC0E3 curl -sSL https://get.rvm.io | bash -s stable rvm list known rvm list rvm install 2.3 ruby...-v gem -v sqlite3 --version gem source -l time gem sources --add https://gems.ruby-china.org/ --remove...https://rubygems.org/ gem install rails rails --version gem list rails new blog cd blog/ head -n 3 Gemfile...vim Gemfile gem install rake -v '11.1.2' bundle install tree rails server gem install uglifier bundle...exec spring binstub --all bundle list | grep uglifier yum install nodejs rails server -b 0.0.0.0 netstat
安装 gem install rails 如果安装过程中出错,可能是ruby版本太低了,先升级ruby //通过brew进行安装升级ruby brew update brew install ruby...switch /Applications/Xcode.app/ 安装sqllit3 如果需要 gem install sqlite3-ruby 继续之前的操作 rails new blog cd blog...bundle install rails server 打开http://0.0.0.0:3000/ 出现页面 说明安装成功。...如果报错 Your Ruby version is 2.3.3, but your Gemfile specified 2.5.1 使用rvm来管理ruby版本,曾经尝试过rbenv 失败了, rvm安装文档...https://blog.csdn.net/napoay/article/details/50510930 切换rvm当前版本到ruby-2.5.1 创建controller文件 bin/rails generate
成功启动,在本地启动浏览器,可以进行访问 (无法从外部访问,原因是并未绑定IP) 直接使用 Ctrl + C 就可以停止此应用 如果希望从外部访问,可以进行如下配置 -b 可以绑定服务 IP [root...@h202 blog]# rails server -b 0.0.0.0 => Booting WEBrick => Rails 4.2.6 application starting in development...on http://0.0.0.0:3000 => Run `rails server -h` for more startup options => Ctrl-C to shutdown server...[2016-04-22 13:47:39] INFO WEBrick 1.3.1 [2016-04-22 13:47:39] INFO ruby 2.3.0 (2015-12-25) [x86_64...@h202 ~]# [root@h202 ~]# vim /etc/sysconfig/iptables [root@h202 ~]# /etc/init.d/iptables reload iptables
其实就是一捆gems Tip: 查看本地有哪些 gem ,可以通过如下方式 [root@h202 ruby]# gem list *** LOCAL GEMS *** actionmailer (4.2.6...(3.0.4) test-unit (3.1.5) thor (0.19.1) thread_safe (0.3.5) tzinfo (1.2.2) [root@h202 ruby]# ---- 创建...Rails 程序 我们创建一个叫 blog 的项目 [root@h202 ruby]# rails new blog create create README.rdoc...@h202 ruby]# echo $?...0 [root@h202 ruby]# ls blog [root@h202 ruby]#
Ruby on Rails Ruby on Rails(简称Rails)是一种使用Ruby编程语言开发的开源Web应用程序框架。...自动化测试 Rails框架鼓励开发人员编写自动化测试代码,以确保应用程序的稳定性和可靠性。Rails提供了一套完整的测试框架,包括单元测试、集成测试和功能测试等。...总结 Ruby on Rails是一个功能强大、易用且开发效率高的Web应用程序框架。...MVC架构 Rails框架采用了MVC架构模式,将应用程序分为模型、视图和控制器三个部分,使代码分离更清晰。这种架构模式使得开发人员可以更好地组织和管理代码,提高了应用程序的可维护性和可测试性。...缺点 性能问题 相比其他编程语言和框架,Ruby on Rails在处理大量并发请求时可能会有一些性能瓶颈。这主要是由于Ruby语言本身的特性和Rails框架的设计理念所致。
介绍 Ruby on Rails使用sqlite3作为其默认数据库,在许多情况下效果很好,但可能不适合您的应用程序。...然后我们将向您展示如何创建使用PostgreSQL作为其数据库服务器的rails应用程序。 准备 本教程要求具有可用的Ruby on Rails开发环境。...3000上的服务器公共IP地址在Web浏览器中访问您的Rails应用程序: 访问网络浏览器: http://server_public_IP:3000 如果您看到“欢迎登陆”Ruby on Rails页面...结论 您现在已准备好在Ubuntu 14.04上使用PostgreSQL作为数据库在Ruby on Rails应用程序上开始开发! 祝好运!...想要了解更多关于使用PostgreSQL和Ruby on Rails应用程序的相关教程,请前往腾讯云+社区学习更多知识。
pkg-config libyaml readline libksba openssl’, showing last 15 lines of /Users/yxp/.rvm/log/1408438961_ruby
1.c:\rails flexstore 2.修改数据库配置文件 database.yml 3.c:\flexstore\ruby script/generate model product 4.c:...\flexstore\ruby script/generate web_service ProductWervice getall find 5.修改如下两个 rb文件 product_service_api.rb...C:\flexstore\ruby script/server 7. http://localhost:3000/Product_Service/service.wsdl wsdl <definitions
ftp.ruby-lang.org/pub/ruby!ruby.taobao.org/mirrors/ruby!'..., Ruby Gems 就安装好了。...设置为系统默认版本 $ rvm 2.0.0 --default 同样,也可以用其他版本号,前提是你有用 rvm install 安装过那个版本 这个时候你可以测试是否正确 $ ruby -v ruby...步骤4 - 安装 Rails 环境 上面 3 个步骤过后,Ruby 环境就安装好了,接下来安装 Rails $ gem install bundler rails 然后测试安装是否正确 $ bundle...-v Bundler version 1.0 $ rails -v Rails 3.2.13
领取专属 10元无门槛券
手把手带您无忧上云