learn-co-curriculum / rails-url-helpers-lab Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
Issue : Confusion due to spec/recent labs+readings
Reasoning : The spec uses "Activate page" alongside the index and show pages, which makes it seem like the "activate page" is an actual html.erb view (as those views are what has been discussed in all of the recent labs/readings).
Suggestion : Make it clearer that the "activate page" is actually just the "activate route" and not an actual view.
Line 27 of student_spec.rb file, student_path should be students_path.
Students have been receiving error upon opening this lab, that they didn't set their secret token in the secrets.yml file:
DEPRECATION WARNING: You didn't set secret_key_base. Read the upgrade documentation to learn more about this new config option. (called from get at /Users//.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/forwardable.rb:183)
has an index page (FAILED - 1)
Multiple students
DEPRECATION WARNING: You didn't set secret_key_base
. Read the upgrade documentation to learn more about this new config option. (called from get at /Users//.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/forwardable.rb:183)
shows them on the index page
Students have been googling and creating their own secrets.yml file, setting the secret token to resolve the issue.
from this stake-overflow post the error raised when using rake version higher than 11 so I think Gemfile should include gem 'rake', '< 11.0'
then bundler should be updated bundle update rake
then bundle install
I am guessing that this lab has been updated recently. The README needs to be ever-so-slightly updated.
It says that "four tests are currently passing". However, when I first ran learn
on this lab, only TWO tests were passing: "Student can be created" and "Student has a to_s instance method".
As far as I can tell right now, that's the only thing that needs to be fixed. Thanks for looking into this!
Update: I just fixed this in a pull request.
---Sdcrouse
Rails.application.routes.draw do
resources :students, only: :index
# This show route can be refactored into the above resources method call, like so:
# resources :students, only: [:index, :show]
# However, for the sake of this lab and seeing how you can pass params through
# the route, we'll keep it explicit for now and refactor later.
get "students/:id", to: "students#show"
end
These comments imply that line 2 and 8 are the equivalent to line 5 when in reality the method student_path (used in the tests) isnt generated by line 2 or 8, only on line 5.
it 'renders properly' do
visit student_path(@student)
expect(page.status_code).to eq(200)
end
Comes in broken. Bundle install? NAHHHH
Dans-MacBook-Pro:module2 danparry$ git clone [email protected]:parryd4/rails-url-helpers-lab-web-040317.git
Cloning into 'rails-url-helpers-lab-web-040317'...
remote: Counting objects: 319, done.
remote: Compressing objects: 100% (167/167), done.
remote: Total 319 (delta 113), reused 319 (delta 113), pack-reused 0
Receiving objects: 100% (319/319), 456.61 KiB | 0 bytes/s, done.
Resolving deltas: 100% (113/113), done.
Dans-MacBook-Pro:module2 danparry$ cd rails-url-helpers-lab-web-040317/
Dans-MacBook-Pro:rails-url-helpers-lab-web-040317 danparry$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.3
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using rack 1.6.4
Using mime-types 2.6.2
Using arel 6.0.3
Using debug_inspector 0.0.2
Using byebug 8.2.0
Using coffee-script-source 1.10.0
Using execjs 2.6.0
Using thor 0.19.1
Using database_cleaner 1.5.1
Using diff-lcs 1.2.5
Using multi_json 1.11.2
Using bundler 1.14.6
Using rspec-support 3.0.4
Using sass 3.4.19
Using tilt 2.0.1
Using spring 1.4.1
Using sqlite3 1.3.11
Using rdoc 4.2.0
Using tzinfo 1.2.2
Installing nokogiri 1.6.6.2 with native extensions
Using rack-test 0.6.3
Using sprockets 3.4.0
Using mail 2.6.3
Using binding_of_caller 0.7.2
Using coffee-script 2.4.1
Using uglifier 2.7.2
Using rspec-core 3.0.4
Using rspec-expectations 3.0.4
Using rspec-mocks 3.0.4
Using sdoc 0.4.1
Using activesupport 4.2.3
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
The file "/usr/include/iconv.h" is missing in your build environment,
which means you haven't installed Xcode Command Line Tools properly.
xcode-select --install
on*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/danparry/.rvm/rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME)
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
/Users/danparry/.rvm/gems/ruby-2.3.0/extensions/x86_64-darwin-16/2.3.0/nokogiri-1.6.6.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
/Users/danparry/.rvm/gems/ruby-2.3.0/gems/nokogiri-1.6.6.2 for inspection.
Results logged to
/Users/danparry/.rvm/gems/ruby-2.3.0/extensions/x86_64-darwin-16/2.3.0/nokogiri-1.6.6.2/gem_make.out
An error occurred while installing nokogiri (1.6.6.2), and Bundler
cannot continue.
Make sure that gem install nokogiri -v '1.6.6.2'
succeeds before bundling.
**OK. I'll use bundle update, because Gemfiles?
Dans-MacBook-Pro:rails-url-helpers-lab-web-040317 danparry$ bundle update**
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 12.0.0 (was 10.4.2)
Using i18n 0.8.1 (was 0.7.0)
Using json 1.8.6 (was 1.8.3)
Using minitest 5.10.1 (was 5.8.3)
Using thread_safe 0.3.6 (was 0.3.5)
Using builder 3.2.3 (was 3.2.2)
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using rack 1.6.5 (was 1.6.4)
Using mime-types-data 3.2016.0521
Using arel 6.0.4 (was 6.0.3)
Using public_suffix 2.0.5
Using debug_inspector 0.0.2
Using bundler 1.14.6
Using byebug 9.0.6 (was 8.2.0)
Using coffee-script-source 1.12.2 (was 1.10.0)
Using execjs 2.7.0 (was 2.6.0)
Using thor 0.19.4 (was 0.19.1)
Using concurrent-ruby 1.0.5
Using database_cleaner 1.5.3 (was 1.5.1)
Using diff-lcs 1.3 (was 1.2.5)
Using multi_json 1.12.1 (was 1.11.2)
Using rdoc 4.3.0 (was 4.2.0)
Using rspec-support 3.0.4
Using sass 3.4.23 (was 3.4.19)
Using tilt 2.0.7 (was 2.0.1)
Using sqlite3 1.3.13 (was 1.3.11)
Using turbolinks-source 5.0.0
Using tzinfo 1.2.3 (was 1.2.2)
Using nokogiri 1.7.1 (was 1.6.6.2)
Using rack-test 0.6.3
Using mime-types 3.1 (was 2.6.2)
Using addressable 2.5.1
Using binding_of_caller 0.7.2
Using coffee-script 2.4.1
Using uglifier 3.2.0 (was 2.7.2)
Using sprockets 3.7.1 (was 3.4.0)
Using sdoc 0.4.2 (was 0.4.1)
Using rspec-core 3.0.4
Using rspec-expectations 3.0.4
Using rspec-mocks 3.0.4
Using turbolinks 5.0.1 (was 2.5.3)
Using activesupport 4.2.3
Using loofah 2.0.3
Using xpath 2.0.0
Using mail 2.6.5 (was 2.6.3)
Using rails-deprecated_sanitizer 1.0.3
Using globalid 0.4.0 (was 0.3.6)
Using activemodel 4.2.3
Using factory_girl 4.8.0 (was 4.5.0)
Using jbuilder 2.6.3 (was 2.3.2)
Using spring 2.0.1 (was 1.4.1)
Using rails-html-sanitizer 1.0.3 (was 1.0.2)
Using capybara 2.13.0 (was 2.5.0)
Using rails-dom-testing 1.0.8 (was 1.0.7)
Using activejob 4.2.3
Using activerecord 4.2.3
Using actionview 4.2.3
Using actionpack 4.2.3
Using actionmailer 4.2.3
Using railties 4.2.3
Using sprockets-rails 3.2.0 (was 2.3.3)
Using coffee-rails 4.1.1 (was 4.1.0)
Using factory_girl_rails 4.8.0 (was 4.5.0)
Using jquery-rails 4.3.1 (was 4.0.5)
Using rspec-rails 3.0.2
Using rails 4.2.3
Using sass-rails 5.0.6 (was 5.0.4)
Using web-console 2.3.0 (was 2.2.1)
Bundle updated!
**Great. Should be ok.
Dans-MacBook-Pro:rails-url-helpers-lab-web-040317 danparry$ learn**
Web Console is activated in the test environment, which is
usually a mistake. To ensure it's only activated in development
mode, move it to the development group of your Gemfile:
gem 'web-console', group: :development
If you still want to run it the test environment (and know
what you are doing), put this in your Rails application
configuration:
config.web_console.development_only = false
**But it came this way:
Gemfile:
...
group :development, :test do
gem 'byebug'
gem 'web-console', '> 2.0'> 3.0.0'
gem 'spring'
gem 'rspec-rails', '
gem 'factory_girl_rails'
gem 'capybara'
gem 'database_cleaner'
end
So I'll follow the suggestion, change it to:
group :development, :test do
gem 'byebug'
gem 'spring'
gem 'rspec-rails', '~> 3.0.0'
gem 'factory_girl_rails'
gem 'capybara'
gem 'database_cleaner'
end
gem 'web-console', '~> 2.0', group: :development
and run try Learn again
Dans-MacBook-Pro:rails-url-helpers-lab-web-040317 danparry$ learn**
Array values in the parameter to Gem.paths=
are deprecated.
Please use a String or nil.
An Array ({"GEM_PATH"=>["/Users/danparry/.rvm/gems/ruby-2.3.0", "/Users/danparry/.rvm/gems/ruby-2.3.0@global"]}) was passed in from bin/rake:3:in `load'
Web Console is activated in the test environment, which is
usually a mistake. To ensure it's only activated in development
mode, move it to the development group of your Gemfile:
gem 'web-console', group: :development
If you still want to run it the test environment (and know
what you are doing), put this in your Rails application
configuration:
config.web_console.development_only = false
/Users/danparry/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:392:in `check_pending!': (ActiveRecord::PendingMigrationError)
Migrations are pending. To resolve this issue, run:
bin/rake db:migrate RAILS_ENV=test
from /Users/danparry/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:405:in `load_schema_if_pending!'
from /Users/danparry/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:411:in `block in maintain_test_schema!'
from /Users/danparry/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:639:in `suppress_messages'
from /Users/danparry/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:416:in `method_missing'
from /Users/danparry/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:411:in `maintain_test_schema!'
from /Users/danparry/Development/code/module2/rails-url-helpers-lab-web-040317/spec/rails_helper.rb:19:in `<top (required)>'
from /Users/danparry/Development/code/module2/rails-url-helpers-lab-web-040317/spec/features/student_spec.rb:2:in `require'
from /Users/danparry/Development/code/module2/rails-url-helpers-lab-web-040317/spec/features/student_spec.rb:2:in `<top (required)>'
from /Users/danparry/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.0.4/lib/rspec/core/configuration.rb:1058:in `load'
from /Users/danparry/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.0.4/lib/rspec/core/configuration.rb:1058:in `block in load_spec_files'
from /Users/danparry/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.0.4/lib/rspec/core/configuration.rb:1058:in `each'
from /Users/danparry/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.0.4/lib/rspec/core/configuration.rb:1058:in `load_spec_files'
from /Users/danparry/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.0.4/lib/rspec/core/runner.rb:97:in `setup'
from /Users/danparry/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.0.4/lib/rspec/core/runner.rb:85:in `run'
from /Users/danparry/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.0.4/lib/rspec/core/runner.rb:70:in `run'
from /Users/danparry/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.0.4/lib/rspec/core/runner.rb:38:in `invoke'
from /Users/danparry/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.0.4/exe/rspec:4:in `<top (required)>'
from /Users/danparry/.rvm/gems/ruby-2.3.0/bin/rspec:22:in `load'
from /Users/danparry/.rvm/gems/ruby-2.3.0/bin/rspec:22:in `<main>'
from /Users/danparry/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
from /Users/danparry/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
**Following the advice didn't fix the problem. But it got me a step farther, by telling me to "rake db:migrate RAILS_ENV=test"
So. Lets try that.
Dans-MacBook-Pro:rails-url-helpers-lab-web-040317 danparry$ rake db:migrate RAILS_ENV=test**
rake aborted!
NoMethodError: undefined method last_comment' for #<Rake::Application:0x007fef1fa36838> /Users/danparry/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.0.4/lib/rspec/core/rake_task.rb:101:in
define'
/Users/danparry/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.0.4/lib/rspec/core/rake_task.rb:78:in initialize' /Users/danparry/.rvm/gems/ruby-2.3.0/gems/rspec-rails-3.0.2/lib/rspec/rails/tasks/rspec.rake:11:in
new'
/Users/danparry/.rvm/gems/ruby-2.3.0/gems/rspec-rails-3.0.2/lib/rspec/rails/tasks/rspec.rake:11:in <top (required)>' /Users/danparry/.rvm/gems/ruby-2.3.0/gems/rspec-rails-3.0.2/lib/rspec-rails.rb:13:in
load'
/Users/danparry/.rvm/gems/ruby-2.3.0/gems/rspec-rails-3.0.2/lib/rspec-rails.rb:13:in block in <class:Railtie>' /Users/danparry/.rvm/gems/ruby-2.3.0/gems/railties-4.2.3/lib/rails/railtie.rb:237:in
instance_exec'
/Users/danparry/.rvm/gems/ruby-2.3.0/gems/railties-4.2.3/lib/rails/railtie.rb:237:in block in run_tasks_blocks' /Users/danparry/.rvm/gems/ruby-2.3.0/gems/railties-4.2.3/lib/rails/railtie.rb:245:in
each'
/Users/danparry/.rvm/gems/ruby-2.3.0/gems/railties-4.2.3/lib/rails/railtie.rb:245:in each_registered_block' /Users/danparry/.rvm/gems/ruby-2.3.0/gems/railties-4.2.3/lib/rails/railtie.rb:237:in
run_tasks_blocks'
/Users/danparry/.rvm/gems/ruby-2.3.0/gems/railties-4.2.3/lib/rails/application.rb:451:in block in run_tasks_blocks' /Users/danparry/.rvm/gems/ruby-2.3.0/gems/railties-4.2.3/lib/rails/engine/railties.rb:13:in
each'
/Users/danparry/.rvm/gems/ruby-2.3.0/gems/railties-4.2.3/lib/rails/engine/railties.rb:13:in each' /Users/danparry/.rvm/gems/ruby-2.3.0/gems/railties-4.2.3/lib/rails/application.rb:451:in
run_tasks_blocks'
/Users/danparry/.rvm/gems/ruby-2.3.0/gems/railties-4.2.3/lib/rails/engine.rb:453:in load_tasks' /Users/danparry/Development/code/module2/rails-url-helpers-lab-web-040317/Rakefile:6:in
<top (required)>'
/Users/danparry/.rvm/gems/ruby-2.3.0/gems/rake-12.0.0/exe/rake:27:in <top (required)>' /Users/danparry/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in
eval'
/Users/danparry/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `
OK. Guess I'm not doing this lab.
!@)%(&!@)(#%&!(#&%!&%#&!#)(%&!)#%&!(@*#@(#%^(@_#%^(!^!(^%(!*#^%(!#^%!#)&%
Hi. I got a little stuck when going through this lab.
When I got to the "activate page" part, it became clear that I needed to redirect to the '/students/:id' route after toggling the student's "active" status on or off. There was just one problem: none of the lessons up to this point have covered how to redirect with Rails (unless that was introduced in the Video Review near the start of the Rails module). I was able to figure it out after some research, thankfully.
I'm not sure whether the "activate page" part should be modified or removed altogether. I'm guessing that its purpose was to have us practice using the :as
option in our routes. Either way, thanks a lot for looking into this!
---Sdcrouse
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.