- 浏览: 242199 次
- 性别:
- 来自: 杭州
文章分类
- 全部博客 (173)
- ruby (38)
- rails (42)
- javascript (7)
- jquery (1)
- linux (15)
- design patterns (1)
- project management (6)
- IT (7)
- life (19)
- data structures and algorithm analysis (2)
- css (1)
- prototype (1)
- mysql (4)
- html (1)
- git (3)
- novels (1)
- c (1)
- Latex (13)
- erlang (1)
- 求职 (1)
- API (0)
- Shell (4)
- Rabbit MQ (1)
- 计算机基础 (1)
- svn (2)
- 疑问 (1)
最新评论
-
zhangyou1010:
回去倒立去,哈哈。
作为一个程序员,身体很重要! -
Hooopo:
Ruby MetaProgramming is all abo ...
Metaprogramming Ruby -
orcl_zhang:
yiqi1943 写道LZ现在上学还是工作呢工作好多年了。不过 ...
2011年 -
yiqi1943:
LZ现在上学还是工作呢
2011年 -
tjcjc:
query cache
就是一个简单的hash
key就是sq ...
Rails sql延迟加载和自带缓存
http状态码http://zh.wikipedia.org/zh/HTTP%E7%8A%B6%E6%80%81%E7%A0%81
rails目录下,actionpack/lib/action_controller/status_codes.rb
rails把状态码和状态信息完全对应起来了,非常好。
rails目录下,actionpack/lib/action_controller/status_codes.rb
rails把状态码和状态信息完全对应起来了,非常好。
module ActionController module StatusCodes #:nodoc: # Defines the standard HTTP status codes, by integer, with their # corresponding default message texts. # Source: http://www.iana.org/assignments/http-status-codes STATUS_CODES = { 100 => "Continue", 101 => "Switching Protocols", 102 => "Processing", 200 => "OK", 201 => "Created", 202 => "Accepted", 203 => "Non-Authoritative Information", 204 => "No Content", 205 => "Reset Content", 206 => "Partial Content", 207 => "Multi-Status", 226 => "IM Used", 300 => "Multiple Choices", 301 => "Moved Permanently", 302 => "Found", 303 => "See Other", 304 => "Not Modified", 305 => "Use Proxy", 307 => "Temporary Redirect", 400 => "Bad Request", 401 => "Unauthorized", 402 => "Payment Required", 403 => "Forbidden", 404 => "Not Found", 405 => "Method Not Allowed", 406 => "Not Acceptable", 407 => "Proxy Authentication Required", 408 => "Request Timeout", 409 => "Conflict", 410 => "Gone", 411 => "Length Required", 412 => "Precondition Failed", 413 => "Request Entity Too Large", 414 => "Request-URI Too Long", 415 => "Unsupported Media Type", 416 => "Requested Range Not Satisfiable", 417 => "Expectation Failed", 422 => "Unprocessable Entity", 423 => "Locked", 424 => "Failed Dependency", 426 => "Upgrade Required", 500 => "Internal Server Error", 501 => "Not Implemented", 502 => "Bad Gateway", 503 => "Service Unavailable", 504 => "Gateway Timeout", 505 => "HTTP Version Not Supported", 507 => "Insufficient Storage", 510 => "Not Extended" } # Provides a symbol-to-fixnum lookup for converting a symbol (like # :created or :not_implemented) into its corresponding HTTP status # code (like 200 or 501). SYMBOL_TO_STATUS_CODE = STATUS_CODES.inject({}) do |hash, (code, message)| hash[message.gsub(/ /, "").underscore.to_sym] = code hash end # Given a status parameter, determine whether it needs to be converted # to a string. If it is a fixnum, use the STATUS_CODES hash to lookup # the default message. If it is a symbol, use the SYMBOL_TO_STATUS_CODE # hash to convert it. def interpret_status(status) case status when Fixnum then "#{status} #{STATUS_CODES[status]}".strip when Symbol then interpret_status(SYMBOL_TO_STATUS_CODE[status] || "500 Unknown Status #{status.inspect}") else status.to_s end end private :interpret_status end end
发表评论
-
calendar
2012-02-24 11:04 862http://fullcalendar.vinsol.com/ ... -
ActiveRecord::Dirty
2011-11-21 10:29 785引用Track unsaved attribute chang ... -
TinyTDS
2011-09-20 09:29 851tiny_tds https://github.com/ra ... -
pandoc-ruby
2011-09-11 11:50 1196https://github.com/alphabetum/p ... -
Rails: Calling render() outside your Controllers
2011-04-28 17:15 830From:http://blog.choonkeat.com/ ... -
为什么这样才能装上
2011-02-20 10:39 1040引用u2@u2-laptop:~$ sudo gem inst ... -
Rails的transaction
2011-01-07 18:36 3054今天同事问我关于rails transaction,如 ... -
Rails sql延迟加载和自带缓存
2010-12-30 01:11 1609color_lot_manuallies = color_lo ... -
关于rhtml
2010-12-23 00:26 865在视图里有这样一段代码 sorted_op_items = o ... -
will_paginate ajax
2010-11-26 13:21 908两种方法 一, @@pagination_options ... -
save > save!(转)
2010-11-19 19:57 749Thoughtbot folks have a great a ... -
USE INDEX with Active Record finders(转)
2010-11-18 22:07 887可以通过强制指定index的方法优化find MySQL do ... -
html转义
2010-11-17 23:03 951$("#contacts").html(& ... -
Scaling Rails很不错的视频
2010-09-29 18:10 819自从railscasts开始讲解rails3后就很久没看了。 ... -
ActionController源码(待续)
2010-09-20 15:14 1019/usr/local/lib/ruby/gems/1.8/ge ... -
rails源码ActionSupport(待续)
2010-08-31 16:59 928一些奇淫技巧 class Object # An ... -
动态的增加auto_complete
2010-08-30 12:17 891http://www.iteye.com/problems/3 ... -
rails 记录
2010-08-26 15:27 736代码里有这样一句 self.purchase_invoices ... -
用Array来实现OrderedHash
2010-08-18 14:29 911偶然发现电脑的角落里有这样的一段代码.功能是用Array实现的 ... -
rails源码ActiveSupport,待续
2010-08-18 14:10 878rails2.3.2 module ActiveSupport ...
相关推荐
Codemirror-rails 为您的Rails应用程序连接资产。 入门 如果您使用的是Bundler,则可以将codemirror-rails添加到Gemfile中: gem 'codemirror-rails' 或手动安装codemirror-rails gem: gem install codemirror-...
With Rails examples, use testing to enable your code to respond better to future change. Plus, see how to handle real-world testing situations. This new edition has been updated to Rails 5.2 and ...
以上就是Rails开发的一些核心概念和工具,"rails-code"这个压缩包很可能包含了书中示例应用的所有源代码,可以帮助读者更好地理解书中讲解的技术点,并动手实践。通过阅读和分析这些代码,你可以加深对Rails的理解,...
Ruby三神书之一(其余的两本是Agile.Web.Development.with.Rails和Ruby For Rails,在我的资源列表也有) ... Owning "Rails Recipes" is like having the best Rails programmers sitting next to you while you code.
Rails的ActiveRecord组件允许开发者通过简单的ORM(Object-Relational Mapping)方式与数据库进行交互,而ActionController负责处理HTTP请求和响应,ActionView则生成HTML输出。此外,Rails还内置了测试框架,如...
《Rails代码》是基于敏捷Web开发的教程,主要聚焦在Ruby on Rails框架的第三个版本上。这个框架是用Ruby编程语言构建高效、可维护的Web应用程序的首选工具。本资源包含的是该书《Agile Web Development with Rails ...
Also new is Webpack coverage, to develop the front-end code for your Rails application. Create a usable and attractive login form using Bootstrap's styles, while ensuring the database table backing ...
This book teaches intermediate to advanced web developers how to use both Ajax and Rails to quickly build high-performance, scalable applications without being overwhelmed with thousands of lines of ...
标题 "rails2 code" 暗示我们关注的是Ruby on Rails框架的第二个主要版本,Rails 2。Rails是一个流行的开源Web应用框架,基于Ruby语言,它遵循“约定优于配置”(Convention over Configuration)的设计理念,使得...
1. **ActiveRecord**:这是Rails框架中的ORM(Object-Relational Mapping)组件,它负责处理数据库操作。通过ActiveRecord,开发者可以使用面向对象的方式来操作数据,而无需编写SQL语句。 2. **ActionController**...
This pioneering book is the first resource that deep dives into the new Rails 3 APIs and shows you how use them to write better web applications and make your day-to-day work with Rails more ...
综上所述,《Ruby on Rails Guides_ A Guide to Testing Rails Applications.pdf》是一个全面的资源,无论你是Rails新手还是资深开发者,都能从中学习到如何为Rails应用编写高质量的测试。从理论到实践,从单元测试...
《Rails101_by_rails4.0》是一本专注于Rails 4.0.0版本和Ruby 2.0.0版本的自学教程书籍,它定位于中文读者,旨在成为学习Rails框架的参考教材。Rails(Ruby on Rails)是一个采用Ruby语言编写的开源Web应用框架,它...
例如,ActiveRecord是Rails中的一个关键组件,它提供了ORM(Object-Relational Mapping)功能,允许开发者用Ruby对象直接操作数据库,无需编写SQL语句。 在Rails中,路由(Routes)是连接URL与控制器动作的桥梁。...
Ruby on Rails,通常简称为Rails,是一个基于Ruby编程语言的开源Web应用框架,遵循MVC(Model-View-Controller)架构模式。这个“Rails项目源代码”是一个使用Rails构建的图片分享网站的完整源代码,它揭示了如何...