Giter VIP home page Giter VIP logo

basic-nested-forms-lab's Introduction

Basic Nested Forms Lab

Objectives

  1. Construct a nested params hash with data about the primary object and a belongs to and has many association.
  2. Name form inputs correctly to create a nested params hash with belongs to and has many associated data.
  3. Define a conventional association writer for the primary model to properly instantiate associations based on the nested params association data.
  4. Define a custom association writer for the primary model to properly instantiate associations with custom logic (like unique by name) on the nested params association data.
  5. Use fields_for to generate the association fields.

Data Model: Recipe with ingredients

The first data model we're going to be working with today is a recipe with ingredients.

  • Recipe
    • has many ingredients
    • title:string
  • Ingredient
    • belongs to a recipe
    • ingredient.name: string
    • ingredient.quantity: string

The models and show routes and associations have been set up for you.

Instructions

Build a recipe form that accepts two ingredients! It should automatically create the new Ingredient objects.

basic-nested-forms-lab's People

Contributors

annjohn avatar aviflombaum avatar danielseehausen avatar ihollander avatar ipc103 avatar jmburges avatar lkwlala avatar maxwellbenton avatar queerviolet avatar trevor-jameson avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

basic-nested-forms-lab's Issues

Solution has some issues

  • Uses partials
  • No longer matches the README. Remove the post/author stuff and just do the ingredient stuff

The README and tests aren't aligned

Hey, so the tests for this lab require that you create a post/artist model that's completely separate from ingredient/recipe model that's referenced in the README. Combined with the fact that there's no solution to this lab, it's quite confusing

partials have not been introduced yet

Following the course curriculum, the use of partials is not introduced until the next module.

Our first test provides failure:

1) the recipe form sets the title
     Failure/Error: <%= render 'form', recipe: @recipe %>

     ActionView::Template::Error:
       Missing partial recipes/_form, application/_form with ...

solution branch doesn't match the lab

solution branch is very out of date:

  • has different view files than the lab gives students
  • the form created in solutions branch uses fields_for differently than what was taught in the preceding readme lesson
  • has files that appear to be from a different lab. for example: 'app/controllers/posts_controller.rb'
  • there are no routes created in 'config/routes.rb'

Rails Console command non-functional for windows?

There seems to be an issue with the lesson where a Windows user will be unable to run rails console. The error message associated with running rails c or rails console mentions Spring loader.

Error Messages:
// โ™ฅ rails c
/usr/local/rvm/gems/ruby-2.3.1/gems/railties-4.2.10/lib/rails/commands/console.rb:29:in block in parse_arguments': invalid option: -b (OptionParser::InvalidOption) from /usr/local/rvm/gems/ruby-2.3.1/gems/railties-4.2.10/lib/rails/commands/console.rb:15:in new'
from /usr/local/rvm/gems/ruby-2.3.1/gems/railties-4.2.10/lib/rails/commands/console.rb:15:in parse_arguments' from /usr/local/rvm/gems/ruby-2.3.1/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:59:in console'
from /usr/local/rvm/gems/ruby-2.3.1/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:39:in run_command!' from /usr/local/rvm/gems/ruby-2.3.1/gems/railties-4.2.10/lib/rails/commands.rb:17:in <top (required)>'
from /usr/local/rvm/gems/ruby-2.3.1/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in require' from /usr/local/rvm/gems/ruby-2.3.1/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in block in require'
from /usr/local/rvm/gems/ruby-2.3.1/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:240:in load_dependency' from /usr/local/rvm/gems/ruby-2.3.1/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in require'
from /home/Kiveo/basic-nested-forms-lab-v-000/bin/rails:9:in <top (required)>' from /usr/local/rvm/gems/ruby-2.3.1/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:268:in load'
from /usr/local/rvm/gems/ruby-2.3.1/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:268:in block in load' from /usr/local/rvm/gems/ruby-2.3.1/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:240:in load_dependency'
from /usr/local/rvm/gems/ruby-2.3.1/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:268:in load' from /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:59:in require'
from /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:59:in require' from -e:1:in

'
Running via Spring preloader in process 686

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.