#3: Controllers


#1

In this lesson, you are expected to generate page controller files, I generate the files and thus I have completed the first task. The second one asks to edit a certain file called, "pages_controller.rb" but the only file available in the specified location is, "application_controller.rb". This is obviously the wrong file so the requested code edits will not work.
(I am using Microsoft edge if this information helps any)

Here is the link to the lesson in question:
https://www.codecademy.com/courses/learn-rails/lessons/start/exercises/start-controller-i?action=lesson_resume


#2

Hi @b.w,

I'm not sure why the file wasn't automatically created, but you could can create it yourself and put this in it for the same effect:

class PagesController < ApplicationController
  # controller code goes here
end

#3

This is the error message you get when you do rails generate controller Pages

/home/ccuser/.gem/ruby/2.3.0/gems/activesupport-4.1.1/lib/active_support/values/time_zone.rb:285: warning: circular argument reference - now
/home/ccuser/.gem/ruby/2.3.0/gems/tzinfo-1.2.2/lib/tzinfo/data_source.rb:182:in `rescue in create_default_data_source': No source of timezone data could be found. (TZInfo::DataSourceNotFound)
Please refer to http://tzinfo.github.io/datasourcenotfound for help resolving this error.
        from /home/ccuser/.gem/ruby/2.3.0/gems/tzinfo-1.2.2/lib/tzinfo/data_source.rb:179:in `create_default_data_source'
        from /home/ccuser/.gem/ruby/2.3.0/gems/tzinfo-1.2.2/lib/tzinfo/data_source.rb:40:in `block in get'
        from /home/ccuser/.gem/ruby/2.3.0/gems/tzinfo-1.2.2/lib/tzinfo/data_source.rb:39:in `synchronize'
        from /home/ccuser/.gem/ruby/2.3.0/gems/tzinfo-1.2.2/lib/tzinfo/data_source.rb:39:in `get'
        from /home/ccuser/.gem/ruby/2.3.0/gems/tzinfo-1.2.2/lib/tzinfo/timezone.rb:629:in `data_source'
        from /home/ccuser/.gem/ruby/2.3.0/gems/tzinfo-1.2.2/lib/tzinfo/timezone.rb:92:in `get'
        from /home/ccuser/.gem/ruby/2.3.0/gems/tzinfo-1.2.2/lib/tzinfo/timezone_proxy.rb:67:in `real_timezone'
        from /home/ccuser/.gem/ruby/2.3.0/gems/tzinfo-1.2.2/lib/tzinfo/timezone_proxy.rb:30:in `period_for_utc'
        from /home/ccuser/.gem/ruby/2.3.0/gems/tzinfo-1.2.2/lib/tzinfo/timezone.rb:549:in `current_period'
        from /home/ccuser/.gem/ruby/2.3.0/gems/activesupport-4.1.1/lib/active_support/core_ext/object/try.rb:45:in `public_send'
        from /home/ccuser/.gem/ruby/2.3.0/gems/activesupport-4.1.1/lib/active_support/core_ext/object/try.rb:45:in `try'
        from /home/ccuser/.gem/ruby/2.3.0/gems/activesupport-4.1.1/lib/active_support/values/time_zone.rb:223:in `utc_offset'
        from /home/ccuser/.gem/ruby/2.3.0/gems/activesupport-4.1.1/lib/active_support/values/time_zone.rb:396:in `block in []'
        from /home/ccuser/.gem/ruby/2.3.0/gems/activesupport-4.1.1/lib/active_support/values/time_zone.rb:396:in `tap'
        from /home/ccuser/.gem/ruby/2.3.0/gems/activesupport-4.1.1/lib/active_support/values/time_zone.rb:396:in `[]'
        from /home/ccuser/.gem/ruby/2.3.0/gems/activesupport-4.1.1/lib/active_support/core_ext/time/zones.rb:60:in `find_zone!'
        from /home/ccuser/.gem/ruby/2.3.0/gems/activesupport-4.1.1/lib/active_support/railtie.rb:20:in `block in <class:Railtie>'
        from /home/ccuser/.gem/ruby/2.3.0/gems/railties-4.1.1/lib/rails/initializable.rb:30:in `instance_exec'
        from /home/ccuser/.gem/ruby/2.3.0/gems/railties-4.1.1/lib/rails/initializable.rb:30:in `run'
        from /home/ccuser/.gem/ruby/2.3.0/gems/railties-4.1.1/lib/rails/initializable.rb:55:in `block in run_initializers'
        from /usr/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
        from /usr/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        from /usr/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
        from /usr/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
        from /usr/lib/ruby/2.3.0/tsort.rb:347:in `each'
        from /usr/lib/ruby/2.3.0/tsort.rb:347:in `call'
        from /usr/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
        from /usr/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
        from /usr/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
        from /home/ccuser/.gem/ruby/2.3.0/gems/railties-4.1.1/lib/rails/initializable.rb:54:in `run_initializers'
        from /home/ccuser/.gem/ruby/2.3.0/gems/railties-4.1.1/lib/rails/application.rb:288:in `initialize!'
        from /home/ccuser/workspace/learn-rails-static/config/environment.rb:5:in `<top (required)>'
        from /home/ccuser/.gem/ruby/2.3.0/gems/railties-4.1.1/lib/rails/application.rb:264:in `require'
        from /home/ccuser/.gem/ruby/2.3.0/gems/railties-4.1.1/lib/rails/application.rb:264:in `require_environment!'
        from /home/ccuser/.gem/ruby/2.3.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:147:in `require_application_and_environment!'
        from /home/ccuser/.gem/ruby/2.3.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:133:in `generate_or_destroy'
        from /home/ccuser/.gem/ruby/2.3.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:51:in `generate'
        from /home/ccuser/.gem/ruby/2.3.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
        from /home/ccuser/.gem/ruby/2.3.0/gems/railties-4.1.1/lib/rails/commands.rb:17:in `<top (required)>'
        from bin/rails:8:in `require'
        from bin/rails:8:in `<main>'

On the bottom of the coding page you also see this message in red:

Oops! The test returned an error. Maybe you have a syntax error, or a typo. Hide error.
/home/ccuser/.gem/ruby/2.3.0/gems/activesupport-4.1.1/lib/active_support/values/time_zone.rb:285: warning: circular argument reference - now

#4

The same error here, i did what you tell to do, but, in the next steps ocurs a conflict with the file created manually!


#5

It looks like this issue involves the tzinfo-data gem. There are a few people who say they've managed to find a solution to this problem, so could you try one of these solutions?

https://discuss.codecademy.com/t/tzinfo-data-error/85895?u=zystvan
https://discuss.codecademy.com/t/pages-controller-rb-not-in-folder/84291/12?u=zystvan

Also, please report the issue through the form beneath the instructions on the left.


#6

It seems to work temporarily, I'll keep trying, thank you for you support! :grin:


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.