Refactoring Model Methods in Ruby On Rails?

Def right_things(all_things, value) all_things. Select{|x| x. Attribute == value} end.

If your things are ActiveRecord models and you only need the items selected for your current purpose, you may, if you're using Rails 2.0 (? definitely 2.1) or above, find named_scopes useful. Class Thing named_scope :rightness, lambda { |value| :conditions => 'attribute =? ', value } end So you can say Thing.

Rightness(123) , which is (in this case) similar to Thing. Find_by_attribute(123) in that it boils down to a SQL query, but it's more easily chainable to modify the SQL. If that's useful to you, which it may not be, of course...

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions