{"id":15152509,"url":"https://github.com/skylar-lorena/superheroes","last_synced_at":"2026-02-10T16:32:45.654Z","repository":{"id":70138352,"uuid":"527117513","full_name":"Skylar-Lorena/Superheroes","owner":"Skylar-Lorena","description":"Building nested forms in Sinatra for creating teams of superheroes.","archived":false,"fork":false,"pushed_at":"2022-08-21T05:51:38.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-13T13:18:34.352Z","etag":null,"topics":["object-oriented-programming","oop-in-ruby","rails","rails-api","rails-application","ruby","ruby-on-rails"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Skylar-Lorena.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-21T05:47:57.000Z","updated_at":"2022-08-21T06:21:28.000Z","dependencies_parsed_at":"2023-03-08T11:45:24.703Z","dependency_job_id":null,"html_url":"https://github.com/Skylar-Lorena/Superheroes","commit_stats":{"total_commits":1,"total_committers":1,"mean_commits":1.0,"dds":0.0,"last_synced_commit":"449aaa20490e99370fa7806572fdfd156ae1df05"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Skylar-Lorena%2FSuperheroes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Skylar-Lorena%2FSuperheroes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Skylar-Lorena%2FSuperheroes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Skylar-Lorena%2FSuperheroes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Skylar-Lorena","download_url":"https://codeload.github.com/Skylar-Lorena/Superheroes/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247639519,"owners_count":20971542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["object-oriented-programming","oop-in-ruby","rails","rails-api","rails-application","ruby","ruby-on-rails"],"created_at":"2024-09-26T16:03:03.026Z","updated_at":"2026-02-10T16:32:45.623Z","avatar_url":"https://github.com/Skylar-Lorena.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sinatra Nested Forms Lab: Superheroes!\n\n## Overview\n\nIn this lab, you'll practice building nested forms in Sinatra for creating teams of superheroes. No database is required, but feel free to add persistence *after* you have successfully completed the instructions below.\n\n## Instructions\n\n### Make a form\n\n1. Create a route that responds to a GET request at `/`.\n2. Create a view with a form and render it in the GET `/` route.\n3. The form should have fields for the `name` of a superhero team and their `motto`.\n4. There should be form inputs for each of the three superhero member's `name`, `power`, and `bio`.\n\nIt should look something like this:\n\n![super_hero.erb](http://i.imgur.com/Ws3nCIC.png)\n\n### Handle form submission\n\n1. Create a route that responds to a POST request at `/teams`.\n2. Have the form send a POST request to this route.\n2. Upon submission, render a template that displays the submitted team data and each member's data.\n\n## Final Output\n\nYour params should be nested. For example, in order to see all the superheroes for the team you just created you would enter: \n\n```ruby\nparams[\"team\"][\"members\"]\n```\nIf you wanted to access the first superhero's name, you would enter:\n\n```ruby\nparams[\"team\"][\"members\"][0][\"name\"]\n```\n\nWhen you post to this form you should render a page that displays the name of the team and each member of the team, along with their name, super power and bio.\n\nYour view should display something like this:\n\n![team.erb](http://i.imgur.com/SsVQ5e0.png)\n\n## Deliverables\n\nPass the tests! You'll notice in `super_sinatra_spec.rb` in the`it submits the form` test for `'POST /teams'`, we use the Capybara method `fill_in`:\n\n```ruby\nfill_in(\"member1_name\", :with =\u003e \"Amanda\")\nfill_in(\"member1_power\", :with =\u003e \"Ruby\")\nfill_in(\"member1_bio\", :with =\u003e \"I love Ruby!\")\n```\n\nThe same pattern follows for the second and third superheroes. The word in quotes after `fill_in` needs to be set as an ID in the form to create the superheroes:\n\n```html\n\u003cinput id=\"member1_name\" type=\"text\" name=\"team[members][][name]\"\u003e\n```\n\n***NOTE***: If you run into any trouble with Sinatra's default configuration, such as needing to set the `views` directory for a particular controller (or to something other than the default `views` folder at the top level of your application directory), take a spin through the [Sinatra configuration documentation](http://www.sinatrarb.com/configuration.html), the [Getting Started guide](http://www.sinatrarb.com/intro), or the old standbys, Google and StackOverflow.\n\n## Resources\n\n* [Ashley William's GitHub](https://github.com/ashleygwilliams/) - [Sinatra Form Party](https://github.com/ashleygwilliams/sinatra-form-party)\n\n* [Ashley William's GitHub](https://github.com/ashleygwilliams/) - [Citibike Sinatra](https://github.com/ashleygwilliams/citibike-sinatra)\n\n\u003cp data-visibility='hidden'\u003eView \u003ca href='https://learn.co/lessons/sinatra-nested-forms-lab-superheros'\u003eSinatra Nested Forms Lab: Superheroes!\u003c/a\u003e on Learn.co and start learning to code for free.\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskylar-lorena%2Fsuperheroes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskylar-lorena%2Fsuperheroes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskylar-lorena%2Fsuperheroes/lists"}