Tagged Questions
1
vote
2answers
106 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.
...
8
votes
5answers
2k views
How would you refactor this if statement of a Rails controller?
I first saw this gigantic if and tried to refactor it. Could only end with a endless switch statement.
Old code -
# It is a Cause
if @causality == "C"
@relationship.cause_id = @issueid
...