GithubHelp home page GithubHelp logo

activerecord-tvshow's People

Watchers

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

activerecord-tvshow's Issues

error while installing json when running bundle install

after running bundle:

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

after running gem install json -v '1.8.6' I get a long error message that begins with error installing json: ERROR: Failed to build gem native extension.

when I run rake -T or learn I get the following error:

Could not find json-1.8.6 in any of the sources Run bundle install to install missing gems.

Permission of ./db folder

I was working with Learn IDE in Windows, and Readme.md told me I needed to make a new folder "db"
I did it, but when I run rake db:migrate, I got SQLite3::CantOpenException: unable to open database file
I solve this by commit and re-clone(I can't chmod directly), and this may cause confusion to others.

Confusing rspec

The specs on highest_rating and most_popular_show ask for the same information, even though highest_rating wants an Integer and most_popular_show wants an Object.

From the spec:

  ::highest_rating
    returns the TV show with the highest rating
  ::most_popular_show
    returns the tv show with the highest rating
  ::lowest_rating
    returns the TV show with the lowest rating
  ::least_popular_show
    returns the tv show with the lowest rating

Can we change highest_rating and lowest_rating to say "returns the [highest/lowest] rating of all the tv shows"?

uninitialized constant ConnectionAdapter

The connection adapter class is no required anywhere in the project.

I added the following code to the /lib/support/db_registry.rb

require_relative 'connection_adapter'

This made it work

missing require_relative

Hi there,

Wanted to raise an issue that almost had me pulling my hair all the way out before I realized what was going on. The db_registry.rb file for this lab is missing the require_relative "./connection_adapter.rb" needed in order to make any of it work.

Thanks,
Alex

Does not drop db after each test

This should be db:droping after each test, or at least after rspec completes? It initially migrates but bad data manifests itself after the first run unless it is dropped.

SQLite3::SQLException: no such table

On Full Stack Web Development V6: Advanced Finding Lab


  1) Show attributes has data attributes given to it from a migration file
     Got 0 failures and 2 other errors:

     1.1) Failure/Error: @rick_and_morty = Show.create(:name => "Rick and Morty", :day => "Thursday", :network => "Adult Swim", :rati
ng => 10)

          ActiveRecord::StatementInvalid:
            Could not find table 'shows'
          # /home/donnadieu/.rvm/gems/ruby-2.6.0/gems/activerecord-4.2.11/lib/active_record/connection_adapters/sqlite3_adapter.rb:50

1:in `table_structure'
          # /home/donnadieu/.rvm/gems/ruby-2.6.0/gems/activerecord-4.2.11/lib/active_record/connection_adapters/sqlite3_adapter.rb:37
5:in `columns'
          # /home/donnadieu/.rvm/gems/ruby-2.6.0/gems/activerecord-4.2.11/lib/active_record/connection_adapters/schema_cache.rb:43:in
 `columns'
          # /home/donnadieu/.rvm/gems/ruby-2.6.0/gems/activerecord-4.2.11/lib/active_record/attributes.rb:93:in `columns'
          # /home/donnadieu/.rvm/gems/ruby-2.6.0/gems/activerecord-4.2.11/lib/active_record/attributes.rb:98:in `columns_hash'
          # /home/donnadieu/.rvm/gems/ruby-2.6.0/gems/activerecord-4.2.11/lib/active_record/inheritance.rb:205:in `subclass_from_attr
ibutes?'
          # /home/donnadieu/.rvm/gems/ruby-2.6.0/gems/activerecord-4.2.11/lib/active_record/inheritance.rb:54:in `new'
          # /home/donnadieu/.rvm/gems/ruby-2.6.0/gems/activerecord-4.2.11/lib/active_record/persistence.rb:33:in `create'
          # ./spec/show_spec.rb:10:in `block (2 levels) in <top (required)>'

Steps to recreate:

  1. Clone master branch
  2. Create app/models/show.rb
class Show < ActiveRecord::Base

end
  1. Create db/migrate/001_create_shows.rb
class CreateShows < ActiveRecord::Migration
  def change
    create_table :shows do |t|
      t.string :name
      t.string :day
      t.string :network
      t.integer :rating
    end
  end
end
  1. Create db/migrate/002_add_season_to_shows.rb
class AddSeasonToShows < ActiveRecord::Migration
  def change
    add_column :shows, :season, :string
  end
end
  1. Run rspec

Solution:

On line 9 in Rakefile change this:
ActiveRecord::Migration.migrate("db/migrate/")

To this:

ActiveRecord::Migrator.migrate("db/migrate/")

Active record version error

in this lab if we add the version it throws this error! ,undefined method `[]' for #ActiveRecord::Migration:0x00000002154698 very confusing to us students when we need to or not to add please clarify , thanks

rake db:migrate no method defined []

Student gets the following error when running rake db:migrate:

-- [](4.2)
-- [](4.2)
rake aborted!
NoMethodError: undefined method `[]' for #<ActiveRecord::Migration:0x007ff0c81f75a0>
/Users/yapjinai/.rvm/gems/ruby-2.3.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:664:in `block in method_missing'
/Users/yapjinai/.rvm/gems/ruby-2.3.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in `block in say_with_time'
/Users/yapjinai/.rvm/gems/ruby-2.3.3/gems/activerecord-
...

In their migration, they originally had:

class AddSeasonToShows < ActiveRecord::Migration[4.2]

But Googling the error points to this StackOverflow answer about versioning. Seems like we need to update to 5.x for this lab. The current workaround as suggested by that answer is to remove the versioning from the migration files:

class AddSeasonToShows < ActiveRecord::Migration

Outdated Gem - Inconsistent

This lab appears to be using an older version of the ActiveRecord gem which is inconsistent with the other labs leading up to this one in which a version needs to be specified for Migration. Raising issue for consistency's sake with previous labs and to avoid user confusion.

Lab

ActiveRecord::StatementInvalid:
Could not find table 'shows'

even though i did create the table. I submitted my code github.

Also, in the active record section, the translating from ORM to ActiveRecord doesn't display the green pass tests. Maybe a bug there too.

Thanks!

Error

Error caused by putting version next to ActiveRecord::Migration.

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.