Last active
December 31, 2015 07:09
-
-
Save nessamurmur/7952204 to your computer and use it in GitHub Desktop.
This seems _bad_. But I've seen it ALOT.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Template < ActiveRecord::Base | |
belongs_to :template_type | |
def some_method | |
if template_type == :type_1 | |
# do type one things | |
elsif template_type == :type_2 | |
# do type two things | |
else | |
# something else | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TemplateType < ActiveRecord::Base | |
has_many :templates | |
TYPES = [:type_1, :type_2, :type_3] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm going to flesh out both these examples more later...