Last active
August 29, 2015 14:11
-
-
Save px-amaac/4d24840521a9eca7a5b7 to your computer and use it in GitHub Desktop.
Can A turn into B with C?
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
| rails generate model section:references{polymorphic}:index step:references<p> | |
| <%= form_for step.codeblocks.build, url: tutorial_step_codeblocks_path(tutorial_id, step.id), method: :post do |codeblock| %> | |
| <div class="field"> | |
| <%= codeblock.label :code %> | |
| <%= codeblock.text_area :code %> | |
| </div> | |
| <div class="field"> | |
| <%= codeblock.label :description %> | |
| <%= codeblock.text_area :description %> | |
| </div> | |
| <%= codeblock.submit "Add CodeBlock", class: "button success" %> | |
| <%= link_to 'Remove CodeBlock', '#', class: 'codeblock-form-hide' %> | |
| <% end %> | |
| </p> |
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
| <p> | |
| <%= form_for step.sections.build, url: tutorial_step_codeblocks_path(tutorial_id, step.id), method: :post do |codeblock| %> | |
| <div class="field"> | |
| <%= codeblock.label :code %> | |
| <%= codeblock.text_area :code %> | |
| </div> | |
| <div class="field"> | |
| <%= codeblock.label :description %> | |
| <%= codeblock.text_area :description %> | |
| </div> | |
| <%= codeblock.submit "Add CodeBlock", class: "button success" %> | |
| <%= link_to 'Remove CodeBlock', '#', class: 'codeblock-form-hide' %> | |
| <% end %> | |
| </p> |
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
| class Codeblock < ActiveRecord::Base | |
| has_many :sections, as: :item | |
| end |
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
| rails generate model section:references{polymorphic}:index step:references |
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
| class Section < ActiveRecord::Base | |
| belongs_to :step | |
| belongs_to :item, polymorphic: true | |
| end |
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
| class Step < ActiveRecord::Base | |
| has_many :tutorial_step_relationships, dependent: :destroy | |
| has_many :tutorials, :through => :tutorial_step_relationships | |
| has_many :codeblocks, dependent: :destroy | |
| has_many :screenshots, dependent: :destroy | |
| has_many :sections, dependent: :destroy | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment