- 浏览: 232401 次
- 性别:
- 来自: 杭州
文章分类
- 全部博客 (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 789http://fullcalendar.vinsol.com/ ... -
ActiveRecord::Dirty
2011-11-21 10:29 731引用Track unsaved attribute chang ... -
TinyTDS
2011-09-20 09:29 768tiny_tds https://github.com/ra ... -
pandoc-ruby
2011-09-11 11:50 1106https://github.com/alphabetum/p ... -
Rails: Calling render() outside your Controllers
2011-04-28 17:15 773From:http://blog.choonkeat.com/ ... -
为什么这样才能装上
2011-02-20 10:39 973引用u2@u2-laptop:~$ sudo gem inst ... -
Rails的transaction
2011-01-07 18:36 2995今天同事问我关于rails transaction,如 ... -
Rails sql延迟加载和自带缓存
2010-12-30 01:11 1533color_lot_manuallies = color_lo ... -
关于rhtml
2010-12-23 00:26 808在视图里有这样一段代码 sorted_op_items = o ... -
will_paginate ajax
2010-11-26 13:21 866两种方法 一, @@pagination_options ... -
save > save!(转)
2010-11-19 19:57 687Thoughtbot folks have a great a ... -
USE INDEX with Active Record finders(转)
2010-11-18 22:07 848可以通过强制指定index的方法优化find MySQL do ... -
html转义
2010-11-17 23:03 895$("#contacts").html(& ... -
Scaling Rails很不错的视频
2010-09-29 18:10 792自从railscasts开始讲解rails3后就很久没看了。 ... -
ActionController源码(待续)
2010-09-20 15:14 955/usr/local/lib/ruby/gems/1.8/ge ... -
rails源码ActionSupport(待续)
2010-08-31 16:59 885一些奇淫技巧 class Object # An ... -
动态的增加auto_complete
2010-08-30 12:17 828http://www.iteye.com/problems/3 ... -
rails 记录
2010-08-26 15:27 678代码里有这样一句 self.purchase_invoices ... -
用Array来实现OrderedHash
2010-08-18 14:29 868偶然发现电脑的角落里有这样的一段代码.功能是用Array实现的 ... -
rails源码ActiveSupport,待续
2010-08-18 14:10 817rails2.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 ...
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.
Summary 94 Chapter 6: Creating Navigation Bars 95 Getting started with a navigation bar 95 Navigation bar helper classes 102 Adding a navigation bar to the Rails application 103 Summary 105 Chapter 7:...
You’ll learn how to create something visible with Rails’ view layer before diving into the more difficult inner layers: the database models and controller code. All you need to begin your Rails ...
This short early adopter book details both how you'll upgrade existing web and other applications from Rails 4.2 to 5 and how to create new applications in Rails 5. The headline features, Rails API ...
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 ...
Connect forms to models by setting up a database, and use Rails' ActiveRecord to create code that maps to database structures • Use Rails scaffolding to build applications from a view-centric ...
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 ...
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 ...
Agile Web Development with Rails 3nd Edition source code
This short early adopter book details both how you’ll upgrade existing web and other applications from Rails 4.2 to 5 and how to create new applications in Rails 5. The headline features, Rails API ...
You concentrate on creating the application, and Rails takes care of the details., Tens of thousands of developers have used this award-winning book to learn Rails. It’s a broad, far-reaching ...
Use Devise to make your Rails application accessible, user friendly, and secure Overview Use Devise to implement an e-mail-based sign-in process in a few minutes Override Devise controllers to allow...
Ruby on Rails strips complexity from the development process, enabling professional developers to focus on what matters most: delivering business value via clean and maintainable code. The Rails™ 3 ...
Rails 4 introduces a number of user-facing changes, and the ebook has been updated to match all the latest changes and new best practices in Rails. This includes full support for Ruby 2.0, controller ...
Ruby on Rails Guides_ A Guide to Testing Rails Applications.pdf
You'll learn to build Rails applications, connect to databases, perform necessary testing, and put the whole thing together to create real-world applications such as shopping carts and online ...
Ruby on Rails strips complexity from the development process, enabling professional developers to focus on what matters most: delivering business value via clean and maintainable code. The Rails™ 3 ...
Head First Rails A Learner's Companion to Ruby on Railsa。 英文版的, 感觉非常不错,强烈推荐。