Tagged Questions
5
votes
1answer
160 views
scopes chaining by OR
How can i DRY these scopes?
scope :reputed, -> {
joins{reputations.outer}.
where{['coalesce(rs_reputations.value, 0) > ? OR purchases.force_active = ?', LOWEST_VOTE, true]}
}
...
2
votes
1answer
89 views
Select records and fill hash
I use ruby 1.8.7. I have method wich select records and fill hash. In my opinion the code is not dry. Could somebody help me to refactor it and make it shorter and more elegant?
def fill_attributes()
...
2
votes
0answers
59 views
How do I DRY this code? [duplicate]
Possible Duplicate:
How do I DRY this code?
Cross posting from StackOverflow by suggestion
I have two main problems with a chunk of code. I need to interpolate 2 different models in a ...
1
vote
2answers
158 views
Refactoring custom validator using lots of if's
I have a custom validator that checks the min and max score of different sporting leagues -- e.g., MLB, NBA, NFL, NCAAB, etc.
Here's short version of what it looks like:
class ScoreValidator < ...
1
vote
2answers
98 views
Rails - Loading data in controllers
I am refactoring my controllers, trying to improve the way common data is loaded for the actions.
Initially I was using before_filter methods to do this but read that helper methods were preferred.
...
1
vote
1answer
188 views
How do I DRY this code?
I have two main problems with a chunk of code. I need to interpolate 2 different models in a specific order in a list.
In the world of casinos, there are different types of games and jackpots. In ...