Code Monkey home page Code Monkey logo

rails-activerecord-model-rails-lab's Introduction

ActiveRecord Model Rails Lab

Objectives

  1. Create a migration by hand
  2. Create a model by hand
  3. Build a model instance method

Building a Model

You can find the test suite for this application in the spec/models directory and run them with the command: bundle exec rspec. This lab tests to ensure that your app can create records and that it has an instance method that can be called on the model.

Instructions

  • Create a folder named migrate in the db directory (By convention ActiveRecord will look for this exact folder name when running migrations.)
  • Create a table by hand named students that has the columns: first_name and last_name โ€“ this should be accomplished by creating a new database migration
  • Create a model for the students' table that inherits from ActiveRecord::Base
  • Implement a to_s instance method in the model that will return the concatenated first and last names for students. For example: first_name: "Daenerys", last_name: "Targaryen" => "Daenerys Targaryen"

rails-activerecord-model-rails-lab's People

Contributors

annjohn avatar bal360 avatar drewprice avatar franknowinski avatar ihollander avatar jmburges avatar jordanhudgens avatar lcorr8 avatar maxwellbenton avatar notnotdrew avatar pletcher avatar

Stargazers

 avatar

Watchers

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

rails-activerecord-model-rails-lab's Issues

JSON 1.8.3 incompatible

I'm on Linux Fedora, using Ruby 2.5.1. (but no ruby version specified anyway) and rbenv. Looked at Issue 303 and so I installed 1.8.6. Then reran bundler to generate new gemfile.lock and everything looks fine for the moment...

An error occurred while installing json (1.8.3), and Bundler cannot
continue.                                                                    
Make sure that `gem install json -v '1.8.3' --source 'https://rubygems.org/'`
succeeds before bundling.                                                    

In Gemfile:
  rails was resolved to 4.2.3, which depends on
    actionmailer was resolved to 4.2.3, which depends on
      actionpack was resolved to 4.2.3, which depends on
        actionview was resolved to 4.2.3, which depends on
          rails-dom-testing was resolved to 1.0.7, which depends on
rails-deprecated_sanitizer was resolved to 1.0.3, which depends
on
              activesupport was resolved to 4.2.3, which depends on
                json

No tests?

When I forked and cloned the lab, the Student model rspec didn't have a test. It had a "pending" but nothing over that. I ended up writing the tests, which I didn't really mind, but I wish it would have been included in the instructions. They currently seem to imply that the tests are built in.

Lab wont advance or complete

i've logged out and learn saved as well as git commit -m , but this lab will not submit work and move forward to the next lab.

Issue with monkey patching

Hello,

I just wanted to complain that the to_s method required to pass this lab is basically monkey patching. It requires us to modify an existing method that Ruby has (to_s) and make it have new functionality. This is just really strange, and I wanted to point this contradiction out (contradicts previous lessons saying not to do this).

ActiveRecord Model and Rails Lab missing crucial detail in Instructions

Hi there! Was helping a student with the ActiveRecord Models and Rails Lab and while attempting to run rake db:migrate as you do, there was no error or information being outputted in the terminal to help assist this error. The solution was the create a migrate directory inside the db directory where your create_table file would live. The Instructions are missing this crucial detail and quite a few students are having this problem as well.

What is the proper channel in resolving this issue for the curriculum?
Or does anyone think this would be a good idea to add that into the instructions as a note or something to assist students in avoiding the confusion?

Here is the instructions snippet from the lab for reference:
Screen Shot 2021-04-05 at 6 58 32 PM

Hope this is helpful!

Need better instrustions

I spent a solid 30 minutes trying to figure out why my migration wasnt working. Even hopped on a zoom call with an instructor for another 20 minutes and went through basically all the same steps I went through by myself and then finally realized it wasn't working because my migration file was not inside a "migrate" folder.

In this lab and the previous one they should definitely state that your migrations need to be in that folder. I do not remember ever learning that and it took up quite a bit of time to try to figure out.

URL update needed

screen shot 2016-01-01 at 5 02 05 pm

Similar to the Fwitter lab, this lab's "View on GitHub" link is not available:

screen shot 2016-01-01 at 5 00 34 pm

However the "Raise an Issue" link brings me here to the learn-co-curriculum account. That must have been how I got the wrong version of the Fwitter lab. I won't make the same mistake again. I'll wait for an update to the student version.

Hope you had a nice NYE!

After removing the Gemfile.lock from this repo, I still can't `bundle install` on Mac M1.

Thanks for raising this issue! Future learners thank you for your diligence. In
order to help the curriculum team address the problem, please use this template
to submit your feedback. We'll work on addressing the issue as soon as we can.

Please fill out as much of the information below as you can (it's ok if you
don't fill out every section). The more context we have, the easier it will be
to fix your issue!

Note: you should only raise issues related to the contents of this lesson.
If you have questions about your code or need help troubleshooting, reach out to
an instructor/your peers.


Link to Canvas

Add a link to the assignment in Canvas here.

Describe the bug

Write a clear and concise description of what the bug is. Include the file and
line number(s) if possible.

What is the expected behavior?

Write a clear and concise description of what you expected to happen.

Screenshots

If applicable, attach screenshots to help explain your problem.

What OS are you using?

  • OS X
  • WSL
  • Linux

Any additional context?

Add any other context about the problem here.

keep running into issue running rspec on this lab

learn
/home/nitrous/code/labs/rails-activerecord-model-rails-lab-v-000/.bundle/gems/sass-3.4.21/lib/sass/tree/visitors/perform.rb:290: warning: literal in condition
/home/nitrous/code/labs/rails-activerecord-model-rails-lab-v-000/.bundle/gems/sass-3.4.21/lib/sass/selector/simple_sequence.rb:91: warning: literal in condition
/home/nitrous/code/labs/rails-activerecord-model-rails-lab-v-000/.bundle/gems/sass-3.4.21/lib/sass/selector/simple_sequence.rb:164: warning: literal in condition
/home/nitrous/code/labs/rails-activerecord-model-rails-lab-v-000/.bundle/gems/sass-3.4.21/lib/sass/selector/simple_sequence.rb:207: warning: literal in condition
/home/nitrous/code/labs/rails-activerecord-model-rails-lab-v-000/.bundle/gems/sass-3.4.21/lib/sass/selector/simple_sequence.rb:207: warning: literal in condition
/home/nitrous/code/labs/rails-activerecord-model-rails-lab-v-000/.bundle/gems/sass-3.4.21/lib/sass/script/functions.rb:2422: warning: literal in condition
/home/nitrous/code/labs/rails-activerecord-model-rails-lab-v-000/.bundle/gems/sass-3.4.21/lib/sass/script/functions.rb:2554: warning: literal in condition
/home/nitrous/code/labs/rails-activerecord-model-rails-lab-v-000/.bundle/gems/sass-3.4.21/lib/sass/script/parser.rb:49: warning: literal in condition
/home/nitrous/code/labs/rails-activerecord-model-rails-lab-v-000/.bundle/gems/sass-3.4.21/lib/sass/script/parser.rb:49: warning: literal in condition
/home/nitrous/code/labs/rails-activerecord-model-rails-lab-v-000/.bundle/gems/sass-3.4.21/lib/sass/script/parser.rb:376: warning: literal in condition
/home/nitrous/code/labs/rails-activerecord-model-rails-lab-v-000/.bundle/gems/sass-3.4.21/lib/sass/script/parser.rb:402: warning: literal in condition
/home/nitrous/code/labs/rails-activerecord-model-rails-lab-v-000/.bundle/gems/sass-3.4.21/lib/sass/script/parser.rb:606: warning: literal in condition
/home/nitrous/code/labs/rails-activerecord-model-rails-lab-v-000/.bundle/gems/sass-3.4.21/lib/sass/script/parser.rb:606: warning: literal in condition
/home/nitrous/code/labs/rails-activerecord-model-rails-lab-v-000/.bundle/gems/sass-3.4.21/lib/sass/scss/parser.rb:512: warning: literal in condition
/home/nitrous/code/labs/rails-activerecord-model-rails-lab-v-000/.bundle/gems/sass-3.4.21/lib/sass/scss/static_parser.rb:65: warning: literal in condition
/home/nitrous/code/labs/rails-activerecord-model-rails-lab-v-000/.bundle/gems/sass-rails-5.0.4/lib/sass/rails/helpers.rb:6: warning: method redefined; discarding old asset_data_url
/home/nitrous/code/labs/rails-activerecord-model-rails-lab-v-000/.bundle/gems/sprockets-3.5.2/lib/sprockets/sass_processor.rb:253: warning: previous definition of asset_data_url was he
re

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.