Snippets: Rails Error on Production

July 05, 2007 @ 05:57 AM | posted by carmelyne

(last updated: 07.05.07)

Quick cheat method to see errors on production mode without the Exception Notifier plugin or having to look at the production log.

1
2
3
4
5
6
7
8
# application.rb
# replace "XXX.X.X.1" with your IP in the local_request method below

protected

def local_request?
  request.remote_ip == "XXX.X.X.1"
end  

[ Last updated: July 05, 2007 @ 06:05 AM ]

Sorry, comments are closed for this article.

Snippets of 06/24/07

Rails 'A'..'Z' Paginate

1
2
3
4
5
6
7
8
9
10
11
# Starts with 'A'..'Z' Paginate / model
def self.sort(sort)
  if sort
    find(:all, :conditions => ['name LIKE ?', "#{sort}%"])
  else
    find(:all, :order => 'name')
  end  
end

# index action / controller
@models = Model.sort(params[:sort]) 

Recent Posts...

RailsConf 2006
I heart devChix