Going through the following book with the error showing: Agile Web Development with Rails 5.1, iteration F5: Broadcasting with Action Cable. As far as I am concerned I followed the directions precisely, my only possible flaw was to type: rails restart rather than rails server again, now it will just not boot anymore! Any possible help is appreciated!
Error in Question:
/Users/dj911ice/.rvm/gems/ruby-2.4.1/gems/railties-5.1.2/lib/rails/railtie/configuration.rb:95:in method_missing: undefined method action_cable_ for # (NoMethodError)
The server error:
Looks like you have a typo around line 57 of config/environments/development.rb, where you are calling config.action_cable_ instead of config.action_cable.
Remove the trailing underscore and restart your rails server.
Related
Im trying to set up api endpoints for my rails application and keep receiving this error my environment is Ruby 2.6 and Rails 5.2 and im using the 'grape' gem for the api here is the blog I followed to set it up. https://medium.com/#ryanwaldorf/how-to-add-an-api-to-an-existing-rails-app-1d2419ba91bd
here is a link to my repo https://github.com/jslack2537/apiDemoApp
I believe the issue is wither in my config/routes.rb or my application.rb files.
But I could be totally wrong. This is a challenge app and not going to be used in production.
This mainly occurs when naming conventions doesn't match. Try changing api/v1/user.rb to api/v1/users.rb which also the blog suggests. You missed a 's'.
Im in the middle of performing an edge ruby and rails update for a web app built in rails 2.3.18 and running ruby 1.9.3.
I have been incrementally been updating the rails version and fixing breaks and things have been moving forward at a steady pace. I have currently made it to ruby 2.1 and rails 3.2.x.x. and have made the push to rails 4.0.0
I have dealt with alot of breaks and errors since the 4.0.0 update and can now get the server to start using rails s but im now getting a new error.
I cannot find literally anything about this error online so im hoping i'll have better luck here. Thx in advance.
This is the line in my controller that triggers this error. Keep in mind this is not my code. Im updating a 8 year old system.
class WpPosts < ActiveRecord::Base
establish_connection "blog"
end
This is the specific line that is firing off the error, but I get this error wherever the is any active record call. Even simpley calling a model in rails console get me this same error.
Things like calling User in rails console get me that same error.
I have already tried:
gem install activerecord -v=4.0.0
and that still gets me the same error. Ive also unistalled all other versions of activerecord.
There is a very short stack trace wich leads me to believe the railties lib is not loading. Or that maybe theres an issue with the path to that lib.
app/models/wp_posts.rb:1:in `<top (required)>'
app/controllers/default_controller.rb:28:in `start'
this is a screenshot of the top of my application.rb file
I am getting error in irb
NameError: uninitialized constant Student
for Student.new or whatever model operations are there.
But in rails it gives no error and it works fine. What would be the reason?
This error only happens in Windows, same code I have in Linux and there it works fine.
What makes the difference here?
irb has nothing to do with your rails project.
What you want instead is to run
rails console
from within your rails project directory. Here you have access to everything defined within the application - Rails loads everything automatically.
rails c
Create new tab in terminal. Here you may work with modals. Like CRUD operations.
But make sure your terminal must pointing in rails working directory before trying rails c command ...
In my rails 3.1 app, I do have
config.action_mailer.raise_delivery_errors = true
in my development.rb file (and, yes, have restarted by local dev server since changing that to true).
However, as I develop new email templates and run into the occasional ActionView::Template::Error
I'm not seeing any of the debugging info being put out as to which line threw the error. (As opposed to when one of my normal app views has a problem the log shows the snippet of the haml source with the problem).
IS there a way to turn on similar debugging messages for mailers?
I use rails console instead of making a web request to test action mailer. It will gives a-lot more info if an error ocures.
$ rails c
> MyMailer::maielr_name( var1, var2 ).deliver!
I thought I read that when a Ruby on Rails server is running in production mode, it won't say so much about an error (the details, showing the code)... but I just try to run the server using
ruby script/server -e production
and add a <%= x %> with the local variable x undefined. It showed a lot of error details including the code... is there a way to make it look better?
It depends on what do you want to achieve - you might add general exception catching / rescue_from procedure to the ApplicationController, and there put error logging and redirect to some generic "we're sorry" page.