
ruby学习
文章平均质量分 71
迅讯
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
ruby--数值类(Numeric)
1,数值类的构成 Numeric(数值)分为四类:1,整数(Integer) 2,浮点小数(Float) 3,有理数(Rational) 4,复数(Complex)其中,Integer有可以分为两种,一种是表示计算机硬件可以处理的Fixnum类,另外一种是比Fixnum更大的数值Bignum类。程序中的整数一般都是在Fixnum范围内的,如果超过了Fixnum的范围,原创 2015-12-22 16:22:10 · 1385 阅读 · 0 评论 -
Ruby rails 页面跳转(render和redirect_to)
redirect_to实现的是action方法的跳转,向浏览器发起一个新的请求,具体使用方法如下:redirect_to :action => 'edit', :id => 7redirect_to "http://wiisola.javaeye.com/"redirect_to "/images/1.jpg"redirect_to :back 其中第4行是回到上一次访问的页面。re转载 2015-12-22 15:36:47 · 879 阅读 · 0 评论 -
ruby学习---数组类(Array)
1,数组的创建 (1)使用[ ]来创建数组 num = [2,3,4,5,6] str = ["a","d","c" ] (2)使用Array.new 来创建 (3)使用%w与%i来创建2,to_a方法。 对散列对象使用to_a方法,结果会得到相应的数组的数组。原创 2015-12-22 17:27:39 · 435 阅读 · 0 评论 -
respond_to 和 respond_with
respond_to可以讓你根據客戶端要求的格式進行不同的格式回應,以 RESTful 與 Rails 中完成的應用程式首頁為例,若想要客戶端在請求http://localhost:3000/bookmarks.html、http://localhost:3000/bookmarks.xml、http://localhost:3000/bookmarks.json時,分別給HTML、XML、JSO转载 2015-12-23 15:35:18 · 6375 阅读 · 0 评论