原创 由於保留字引起 Can't mass-assign these protected attributes 的錯誤
做一個例子的時候 數據庫中使用了一列爲type,結果報出了錯誤, 我比較奇怪我在model中並沒有進行相關的設置, 後來想想可能是與rails的保留字衝實了 ,google的一下 結果的確是這樣。因爲是保留字,系統自動保護不讓外部賦值。
原创 Redcar: 兼容 TextMate Bundles 的程序員編輯器
剛剛發現在的一個linux編輯器,是用ruby開發的。安裝過程按照說明還是蠻簡單的,可能過程,裝的時候碰到一點小錯誤不過看了一些帖子就解決了。 官方地址 :http://redcareditor.com/ 安裝說明: http:/
原创 又一個php 框架 doophp 框架
無意中看到又出了一個php框架(官網:http://www.doophp.com/features),和yii一樣也是華人開發的,時間也很短,不到1個月吧。 官網這樣介紹 它: Doo framework is one of th
原创 四種div等高列的方法
1.使用display: table <div class=”base”> <ul class=”base-row”> <li class="cell1"><div class="content1" >.....Lots
原创 apple 官網reset.css
html,body,div,ul,ol,li,dl,dt,dd,h1,h2,h3,h4,h5,h6,pre,form,p,blockquote,fieldset,input { margin: 0; padding: 0;
原创 rails的seeding已經實現
在http://ryandaigle.com/中這篇文章: What's New in Edge Rails: Database Seeding 中
原创 What is mattr_accessor in a Rails module?
module Config mattr_accessor :hostname mattr_accessor :admin_email end #s short for: module Config def self.hos
原创 rails 自定義配置
time formate Time::DATE_FORMATS[:month_and_year] = "%B %Y" Time::DATE_FORMATS[:short_ordinal] = lambda { |time| time.
原创 facebox.js 添加新功能
使用facebox時, 我們要點擊關閉按鈕時, 遮罩層才消失, 默認是沒有這個功能的.這個功能很簡單,就是阻止關閉事件的觸發就行了. 首先在settings加入默認值,方便我們使用的時候定置效果 settings: { opac
原创 記錄下來關於for each區別
http://www.letrails.cn/archives/difference-between-for-loop-and-each/ 上看到 for和each的區別主要在於: for是通過調用each實現,因此for更慢一些
原创 41條幫你提高網站排名
1、關鍵詞 關鍵詞在網站TITLE上的使用 2、外部鏈接 外部鏈接的錨文字 3、網站品質 網站的外部鏈接流行度、廣泛度 4、網站品質 域名年齡(從被搜索引擎索引開始計算) 5、頁面質量 網站內部鏈接
原创 關於returning
在beast的記錄中看到一個方面中用到returning的用法。 def reply(topic, body) returning topic.posts.build(:body => body) do |post|
原创 rails 3 新的 驗證寫法
在源文件中看到新的寫法 和前面相差很多, 不過老方案在rails3也不會出錯 Examples of using the default rails validators: validates :terms, :accepta
原创 rails3 路由筆記
rails3 路由發生了劇大的變化, 是居於項目名稱的 Redmine::Application.routes.draw do |map| rest路由eg. resources :trackers #簡單路由: match '/pr
原创 rails 3 activerecord new interface
In short, passing options hash containing :conditions, :include, :joins, :limit, :offset, :order, :select, :readonly