gem install rails
rails new my_app -T
| [8] pry(main)> class A;;end | |
| => nil | |
| [9] pry(main)> a1 = A.new | |
| => #<A:0xab50838> | |
| [10] pry(main)> a2 = A.new | |
| => #<A:0xa8871b0> | |
| [11] pry(main)> ObjectSpace.each_object(A){|object| p object} | |
| #<A:0xa8871b0> | |
| #<A:0xab50838> |
#Behold, the nav_link:
The nav_link helper works just like the standard Rails link_to helper, but adds a 'selected' class to your link (or its wrapper) if certain criteria are met. By default, if the link's destination url is the same url as the url of the current page, a default class of 'selected' is added to the link.
For full usage details, see: http://viget.com/extend/rails-selected-nav-link-helper
Drop nav_link_helper.rb into app/helpers in your Rails 3.x app and enjoy.
| # For RVM | |
| yum install -y bash curl git libxslt # NOTE: For git you need the EPEL repository enabled | |
| apt-get install bash curl git-core | |
| # OS => Redhat/CentOS/Fedora | |
| yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel | |
| yum install -y make bzip2 | |
| yum install -y iconv-devel # NOTE: For centos 5.4 final iconv-devel might not be available :( | |
| # OS => Debian/Ubuntu |
| cassettes |
| module ActionController | |
| module ImplicitRender | |
| def default_render | |
| # lookup template exist? go to render it | |
| render and return if template_exists?(action_name.to_s, _prefix) | |
| has_template = begin | |
| old_formats, @lookup_context.formats = @lookup_context.formats, Mime::SET.symbols | |
| template_exists?(action_name.to_s, _prefix) |
| #!/usr/bin/env ruby | |
| #curl https://raw.github.com/gist/1206310 --output create_mysql_db.rb && chmod +x create_mysql_db.rb | |
| require 'rubygems' | |
| require 'optparse' | |
| require 'mysql' | |
| options = {} | |
| OptionParser.new do |opts| |
| production: | |
| listen: 0.0.0.0:9312 | |
| address: 0.0.0.0 # 对应的安装了searchd(sphinx)的mysql服务器ip | |
| port: 9312 # 对应的安装了searchd(sphinx)的mysql服务器端口 | |
| bin_path: '/usr/local/bin' | |
| searchd_file_path: '/data/sphinx/production' | |
| query_log_file: '/data/sphinx/log/searchd.query.log' | |
| searchd_log_file: '/data/sphinx/log/searchd.log' | |
| exceptions: '/data/sphinx/log//exception.log' | |
| enable_star: true # 支持通配符匹配 |