Skip to content

Instantly share code, notes, and snippets.

@laurenhavertz
Last active December 19, 2015 14:29
Show Gist options
  • Select an option

  • Save laurenhavertz/5969925 to your computer and use it in GitHub Desktop.

Select an option

Save laurenhavertz/5969925 to your computer and use it in GitHub Desktop.
RAILS RESOURCES

<%= select_month(Date.today) %> renders drop down of months (can substitue for days and years)

Writing Your Own Helper

module ApplicationHelper

  def pig_latin str
    str + "piglatined"
  end 

end

COOK BOOK APP

  • Book (has_many Ingredients)

    • title
    • author
    • type
    • id
  • Recipe (has_many Ingredients/belongs_to Book)

    • name
    • id
    • ingredients
  • Ingredients(belongs_to Recipie)

    • name
    • id
  • Ingredients_Recipe(many-to-many relationship: has_many Recipe& has_many Ingredients)

    • recipe id
    • ingredient id
  • Create The Models

  • Add Fields in the Migration Tables

  • Create the Join Table rails g migration add_ingredients_recipes_table

  • Migrate that guy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment