Notes posted by Ramon
RSS feed
Ramon -
December 14, 2012 - (>= v3.2.1)
0 thanks
Now called class_attribute in Rails 3.2.x
See github.com/novafabrica/make_exportable/pull/4
Ramon -
November 3, 2010 - (<= v2.3.8)
0 thanks
Get the primary schema's name
If you’re using PostgreSQL and you’ve changed schema, sometimes you need to know what schema you’re in.
ActiveRecord::Base.connection.schema_search_path.split(",").first
Ramon -
March 10, 2010
0 thanks
Specify your own template
You can specify you own template this way:
def notice ... @template = "some_other_name.html.erb" end
Ramon -
October 3, 2009
0 thanks
sort_by
array.sort_by {|element| [element.foo, element.bar.name, element.baz]}
Taken from http://redcorundum.blogspot.com/2006/10/using-sortby-instead-of-sort.html
Ramon -
June 11, 2009
4 thanks
Ramon -
June 11, 2009
2 thanks
How to use with exclusive scope
Code example
Article.with_exclusive_scope { find(:all) } #=> "SELECT * FROM 'articles'
from http://ryandaigle.com/articles/2008/11/18/what-s-new-in-edge-rails-default-scoping