0

Just getting started with a rails api and ember frontend. I'm using ember-cli-rails and puma-dev. I'm getting an error when visiting the localhost at .test. I'm not sure what is causing it, or if it's due to both the front and back end bring set to "/".

Any point in the right direction would be appreciated!

NoMethodError undefined method `has_key?' for nil:NilClass Extracted source (around line #19):

  def action_encoding_template(action) # :nodoc:
    *if @_parameter_encodings.has_key?(action.to_s)*
      @_parameter_encodings[action.to_s]
    end
  end

https://github.com/wjacobs71086/keenmind

  • where does `@_parameter_encodings` come from? – NullVoxPopuli Mar 13 '22 at 22:52
  • I'm guessing it's from a node_module since it's not in the main code base. – wjacobs786 Mar 13 '22 at 23:41
  • It may be worth noting that if I change config > routes.rb to a new path, then when viewing the"/" path, I see the default rails page and no error. Then viewing the new path I get the error. This seems to indicate that the issue is the ember build and not the rails API. – wjacobs786 Mar 14 '22 at 01:10
  • 1
    Can you trace the error? JavaScript and node modules have no direct impact on ruby code / gems, so i'm curious what is going on, and when the ruby code is looking for and not getting. – NullVoxPopuli Mar 14 '22 at 03:12
  • It's been a long while for me since using ruby, but have you followed all the steps in the README here? https://github.com/thoughtbot/ember-cli-rails – NullVoxPopuli Mar 14 '22 at 03:14
  • I followed the steps and did what I could to compare what I had to the example project they have listed. I may try again today without using puma-dev. – wjacobs786 Mar 14 '22 at 16:05

1 Answers1

0

I checked your repository out and I was able to (partially) fix it… Change the following:

- class ApplicationController < ActionController::API
+ class ApplicationController < ActionController::Base
gnclmorais
  • 4,897
  • 5
  • 30
  • 41