Skip to content

Instantly share code, notes, and snippets.

def rescue_action_in_public(exception)
case exception
when ::ActionController::RedirectBackError
redirect_to homepage_url
else
super
end
end
#http://blog.hendrikvolkmer.de/2007/3/8/http-referer-and-redirect_to-back/
#http://www.javaeye.com/topic/135552
http://twitter.com/chiliconsulting
http://www.inside.com.tw/01/09/日本重量級科技部落格asiajin在台演講速記:日本最新
Akky 介紹 Sekai Camera,這個augmented reality 的 iPhone app在日本小有名氣
about 7 hours ago from Seesmic
儘管如此,Akky 仍然認為,國外的手機還是會打敗日本的手機,最後日本製的手機還是會在日本市場消失
about 7 hours ago from Seesmic
Akky 想說明幾點大家對日本的誤解:1. 大家都認為 Qwerty 鍵盤是最好的輸入方式; 2. 每個人都想在手機上體驗 PC 的經驗... 但對日本人而言卻不是如此
about 7 hours ago from Seesmic
作者: ted32407 (OM) 看板: StupidClown
標題: [奇遇]崩潰的詐騙集團
時間: Mon May 25 10:39:37 2009
由於這個週末小曹又報了,這個禮拜我的心情相當沮喪
沒什麼心情搞笑,事件發生的禮拜日我就像是行屍走肉
對什麼也都毫不在意,也沒kuso的心情
原本還在考慮要不要上笨版po一下 因為想說可能沒什麼笑點
大家可能沒看完就發生的經過就←,發生的經過也很長也就懶得打了
後來想想po上來大家口耳相傳,多少可以防詐騙
Number($('#basicPrice').val()) <= 0
file = File.new("#{RAILS_ROOT}/log/ack_analytic", 'w')
file.puts "Ack Analytic"
file.print "\n"
h.each do |a|
file.print "#{a[0]} #{a[1]} "
(a[1]/5).times do
file.print "="
end
file.print "\n"
class ActiveRecord::Base
named_scope :conditions, lambda { |*args| {:conditions => args} }
end
def self.find_by(email, nick, firstname, lastname)
scope = self.scoped({})
scope = scope.conditions "members.email LIKE ?", "%#{email}%" unless email.blank?
scope = scope.conditions "members.nick LIKE ?", "%#{nick}%" unless nick.blank?
scope = scope.conditions "members.firstname LIKE ?", "%#{firstname}%" unless firstname.blank?
scope = scope.conditions "members.lastname LIKE ?", "%#{lastname}%" unless lastname.blank?
output = StringIO.new
gz = Zlib::GzipWriter.new(output)
gz.write(all_exchanges.to_json)
gz.close
render :text => output.string, :content_type => 'application/x-gzip' and return
# user and group to run as
user ez ez;
# number of nginx workers
worker_processes 6;
# pid of nginx master process
pid /var/run/nginx.pid;
# Number of worker connections. 1024 is a good default
#<a href="http://ow.ly/18z1T">RoR Multi-step forms</a>
private
def get_partial_user_from_session
unless @session['partial_user'].nil?
@user = @session['partial_user']
else
@user = User.new
end
end
在restful的前提下, 遇到class的to_param是字串, 而剛好某筆
紀錄的to_param欄位含有.
一般情形下會發生錯誤, 因為restful會把.後的東西當成format
這時的解法, 變成要在routes.rb中的xxx.resources加上參數
ex:
map.resources :categories, :requirements => {:id => /.*/}