learn-co-curriculum / activerecord-tvshow Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
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.
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.
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"?
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
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
This should be db:drop
ing 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.
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:
class Show < ActiveRecord::Base
end
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
class AddSeasonToShows < ActiveRecord::Migration
def change
add_column :shows, :season, :string
end
end
rspec
Solution:
On line 9
in Rakefile
change this:
ActiveRecord::Migration.migrate("db/migrate/")
To this:
ActiveRecord::Migrator.migrate("db/migrate/")
Without these files/folders the solution branch is basically useless.
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
In "show_spec.rb", the tests are written with pound signs (#), which indicate they are instance methods. They should be declared as class methods instead.
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
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.
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 when trying put brackets after ActiveRecord::Migration
Solution: Don't use a version number -> class CreateShows < ActiveRecord::Migration
This version is inconsistent with the rest of the labs. Should be updated as I noticed it's been reported months ago
Error caused by putting version next to ActiveRecord::Migration.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.