学习链接:http://rubyer.me/blog/583/ RESTful风格的路由动词默认有7个(分别为:index, show, create, new, edit, update, destroy). 有时我们需要自定义路由,这时就要用到:on参数.:on参数有三种取值,分别为collection,member,new. 如果想添加一个member方式的路由,可以这样: resources :photos do member do get 'preview' end end 将会添加一…
最近配置production环境,找了好几份文档,从傻逼到苦逼~~终于配置成功~~@_@!!! 首先,先加载以下几个插件: # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # Use CoffeeScript for .js.coffee assets and views gem 'coffee-rails', '~> 4.0.0'# Use jquery as the JavaScri…
Need to add image attachments to a model? See how with paperclip in this episode. 在命令行输入: rails g paperclip product photo rake db:migrate 注:product是你要添加属性的models中的.rb文件名,photo是要插入的图片在数据表中的属性名 配置models/product.rb has_attached_file :photo, :styles => {…