Last active
May 8, 2020 00:04
-
-
Save ZephiroRB/fc4a29f0850d0b3fab6ff1e852c8ece3 to your computer and use it in GitHub Desktop.
Generate Migrate or Model with Polymorphic relationships
This file contains hidden or 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
#migration | |
rails g migration AddConditionableToConditionalObjetives conditionable:references:\{polymorphic\} | |
#migration | |
rails g model ConditionalObjetive conditionable:references:\{polymorphic\} | |
#generate | |
class AddConditionableToConditionalObjetives < ActiveRecord::Migration | |
def change | |
add_reference :conditional_objetives, :conditionable, polymorphic: true, index: true | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment