Thanks Xuan and Colin for your attention.

Xuan <[email protected]> writes:

> You may try adding a "default_scope :select=>'id, name, etc'  " to
> your model. This would accomplish what you are looking for,

That was exactly what I was looking for.

My actual implentation looked like this in my AR class

  DEFAULT_SELECT = "#{column_names.reject{|c| c =~ /image/ }.map{|c| 
"\"orders\".\"#{c}\""}.join(', ')}".freeze
  default_scope :select => DEFAULT_SELECT

And the very few places that I need all columns, I have added :select
=> '*' to the find call

> but I can't assure it won't give you problems later in your
> code. Maybe you should add a regular named_scope with parameters and
> use it instead of 'find'.

Fortunately I have thousands of tests to asure that :-)

Jarl

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to