Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined local variable or method context #32

Closed
ringvold opened this issue Sep 11, 2016 · 7 comments
Closed

undefined local variable or method context #32

ringvold opened this issue Sep 11, 2016 · 7 comments

Comments

@ringvold
Copy link

When I'm including JSONAPI::Utils in my base controller I get an error:

undefined local variable or method `context' for #<Api::V1::AuthController:0x007fa0f2ec1158>

It seems like the variable context on line 13 in setup_request in JSONAPI::Utils:Request does not exist. I'm not sure where context should come from. I thought is might be because i used ActionController::Metal, but the error shows when I use ActionController::Base.

Has anyone else experienced this before?

I'm using JU 0.4.6 with rails 4.2.3

@tiagopog
Copy link
Owner

tiagopog commented Sep 13, 2016

@ringvold, are you installing the jsonapi-resources gem in separate or are you using the built-in from jsonapi-utils? If possible, could you share your Gemfile.lock?

@tiagopog
Copy link
Owner

Any news about this issue?

@ringvold
Copy link
Author

Sorry. I haven't had time to look into this.
I used jsonapi-resources standalone before using jsonapi-utils. But when I installed jsonapi-utils I checked that the versions where the same.
I'll share my Gemfile.lock later today.

@tiagopog
Copy link
Owner

No problem. It might be related to some incompatibility between the versions of JU and JR, but I can only be sure after seeing your Gemfile.lock.

@ringvold
Copy link
Author

Gemfile.lock

GIT
  remote: git://github.com/ifad/data-confirm-modal.git
  revision: 3ad63b3f71762691d853f29a14664518f6f2d11a
  specs:
    data-confirm-modal (1.2.0)
      railties (>= 3.0)

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (4.2.3)
      actionpack (= 4.2.3)
      actionview (= 4.2.3)
      activejob (= 4.2.3)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 1.0, >= 1.0.5)
    actionpack (4.2.3)
      actionview (= 4.2.3)
      activesupport (= 4.2.3)
      rack (~> 1.6)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (4.2.3)
      activesupport (= 4.2.3)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    activejob (4.2.3)
      activesupport (= 4.2.3)
      globalid (>= 0.3.0)
    activemodel (4.2.3)
      activesupport (= 4.2.3)
      builder (~> 3.1)
    activerecord (4.2.3)
      activemodel (= 4.2.3)
      activesupport (= 4.2.3)
      arel (~> 6.0)
    activesupport (4.2.3)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    addressable (2.4.0)
    ansi (1.5.0)
    arel (6.0.3)
    bcrypt (3.1.11)
    builder (3.2.2)
    byebug (9.0.5)
    capybara (2.8.1)
      addressable
      mime-types (>= 1.16)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      xpath (~> 2.0)
    cliver (0.3.2)
    coderay (1.1.1)
    coffee-rails (4.1.1)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.1.x)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.10.0)
    concurrent-ruby (1.0.2)
    debug_inspector (0.0.2)
    diff-lcs (1.2.5)
    enumerize (2.0.0)
      activesupport (>= 3.2)
    erubis (2.7.0)
    execjs (2.7.0)
    factory_girl (4.7.0)
      activesupport (>= 3.0.0)
    factory_girl_rails (4.7.0)
      factory_girl (~> 4.7.0)
      railties (>= 3.0.0)
    faker (1.6.6)
      i18n (~> 0.5)
    faraday (0.9.2)
      multipart-post (>= 1.2, < 3)
    ffi (1.9.14)
    figaro (1.1.1)
      thor (~> 0.14)
    font-awesome-rails (4.6.3.1)
      railties (>= 3.2, < 5.1)
    formatador (0.2.5)
    globalid (0.3.7)
      activesupport (>= 4.1.0)
    guard (2.14.0)
      formatador (>= 0.2.4)
      listen (>= 2.7, < 4.0)
      lumberjack (~> 1.0)
      nenv (~> 0.1)
      notiffany (~> 0.0)
      pry (>= 0.9.12)
      shellany (~> 0.0)
      thor (>= 0.18.1)
    guard-compat (1.2.1)
    guard-rspec (4.7.3)
      guard (~> 2.1)
      guard-compat (~> 1.1)
      rspec (>= 2.99.0, < 4.0)
    haml (4.0.7)
      tilt
    haml-rails (0.9.0)
      actionpack (>= 4.0.1)
      activesupport (>= 4.0.1)
      haml (>= 4.0.6, < 5.0)
      html2haml (>= 1.0.1)
      railties (>= 4.0.1)
    html2haml (2.0.0)
      erubis (~> 2.7.0)
      haml (~> 4.0.0)
      nokogiri (~> 1.6.0)
      ruby_parser (~> 3.5)
    i18n (0.7.0)
    jquery-rails (4.2.1)
      rails-dom-testing (>= 1, < 3)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    json (1.8.3)
    jsonapi-resources (0.7.0)
      rails (>= 4.0)
    jsonapi-utils (0.4.6)
      jsonapi-resources (~> 0.7.0)
    jwt (1.5.4)
    listen (3.1.5)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
      ruby_dep (~> 1.2)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    lumberjack (1.0.10)
    mail (2.6.4)
      mime-types (>= 1.16, < 4)
    method_source (0.8.2)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    mini_portile2 (2.1.0)
    minitest (5.9.0)
    multi_json (1.12.1)
    multi_xml (0.5.5)
    multipart-post (2.0.0)
    nenv (0.3.0)
    nokogiri (1.6.8)
      mini_portile2 (~> 2.1.0)
      pkg-config (~> 1.1.7)
    notiffany (0.1.1)
      nenv (~> 0.1)
      shellany (~> 0.0)
    oauth (0.5.1)
    oauth2 (1.2.0)
      faraday (>= 0.8, < 0.10)
      jwt (~> 1.0)
      multi_json (~> 1.3)
      multi_xml (~> 0.5)
      rack (>= 1.2, < 3)
    pg (0.18.4)
    pkg-config (1.1.7)
    poltergeist (1.10.0)
      capybara (~> 2.1)
      cliver (~> 0.3.1)
      websocket-driver (>= 0.2.0)
    pry (0.10.4)
      coderay (~> 1.1.0)
      method_source (~> 0.8.1)
      slop (~> 3.4)
    rack (1.6.4)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (4.2.3)
      actionmailer (= 4.2.3)
      actionpack (= 4.2.3)
      actionview (= 4.2.3)
      activejob (= 4.2.3)
      activemodel (= 4.2.3)
      activerecord (= 4.2.3)
      activesupport (= 4.2.3)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.2.3)
      sprockets-rails
    rails-deprecated_sanitizer (1.0.3)
      activesupport (>= 4.2.0.alpha)
    rails-dom-testing (1.0.7)
      activesupport (>= 4.2.0.beta, < 5.0)
      nokogiri (~> 1.6.0)
      rails-deprecated_sanitizer (>= 1.0.1)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    rails_12factor (0.0.3)
      rails_serve_static_assets
      rails_stdout_logging
    rails_serve_static_assets (0.0.5)
    rails_stdout_logging (0.0.5)
    railties (4.2.3)
      actionpack (= 4.2.3)
      activesupport (= 4.2.3)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (11.2.2)
    rb-fsevent (0.9.7)
    rb-inotify (0.9.7)
      ffi (>= 0.5.0)
    rspec (3.5.0)
      rspec-core (~> 3.5.0)
      rspec-expectations (~> 3.5.0)
      rspec-mocks (~> 3.5.0)
    rspec-core (3.5.2)
      rspec-support (~> 3.5.0)
    rspec-expectations (3.5.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.5.0)
    rspec-mocks (3.5.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.5.0)
    rspec-rails (3.5.2)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec-core (~> 3.5.0)
      rspec-expectations (~> 3.5.0)
      rspec-mocks (~> 3.5.0)
      rspec-support (~> 3.5.0)
    rspec-support (3.5.0)
    ruby_dep (1.4.0)
    ruby_parser (3.8.2)
      sexp_processor (~> 4.1)
    sass (3.4.22)
    sass-rails (5.0.6)
      railties (>= 4.0.0, < 6)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    sexp_processor (4.7.0)
    shellany (0.0.1)
    simple_form (3.3.1)
      actionpack (> 4, < 5.1)
      activemodel (> 4, < 5.1)
    slop (3.6.0)
    sorcery (0.9.1)
      bcrypt (~> 3.1)
      oauth (~> 0.4, >= 0.4.4)
      oauth2 (>= 0.8.0)
    spring (1.7.2)
    sprockets (3.7.0)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.0)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    thor (0.19.1)
    thread_safe (0.3.5)
    tilt (2.0.5)
    turbolinks (5.0.1)
      turbolinks-source (~> 5)
    turbolinks-source (5.0.0)
    turn (0.9.6)
      ansi
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    uglifier (3.0.2)
      execjs (>= 0.3.0, < 3)
    versionist (1.5.0)
      activesupport (>= 3)
      railties (>= 3)
      yard (~> 0.7)
    web-console (3.3.0)
      activemodel (>= 4.2)
      debug_inspector
      railties (>= 4.2)
    websocket-driver (0.6.4)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.2)
    xpath (2.0.0)
      nokogiri (~> 1.3)
    yard (0.9.5)

PLATFORMS
  ruby

DEPENDENCIES
  byebug
  capybara
  coffee-rails (~> 4.1.0)
  data-confirm-modal!
  enumerize
  factory_girl_rails
  faker
  figaro
  font-awesome-rails
  guard
  guard-rspec
  haml-rails (~> 0.9)
  jquery-rails
  jsonapi-utils (~> 0.4.6)
  pg
  poltergeist
  rails (= 4.2.3)
  rails_12factor
  rspec-rails
  sass-rails (~> 5.0)
  simple_form
  sorcery (~> 0.9)
  spring
  turbolinks
  turn
  uglifier (>= 1.3.0)
  versionist
  web-console (~> 3.0)

RUBY VERSION
   ruby 2.3.1p112

BUNDLED WITH
   1.12.5

@chrisdpeters
Copy link
Contributor

chrisdpeters commented Sep 29, 2016

I was getting a very similar error about key_formatter from that same method (setup_request) in my Rails 4.2.7.1 app. Upgrading to 0.5.0.beta3 fixed it for me. So it seems like there is something missing from JSONAPI::Utils in v0.4.6 after including it in the controller.

I'd assume that I'd get a similar error about context if I weren't implementing that method in my base controller.

@tiagopog
Copy link
Owner

Since there's no further reports about this issue I will consider it closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants