Questions tagged [ruby-on-rails-5]

For issues specific to version 5.x.y of Rails. If your question applies to Ruby on Rails in general, use the tag [ruby-on-rails].

Ruby on Rails 5 is the previous major revision of Ruby on Rails, "an open-source web framework that's optimized for programmer happiness and sustainable productivity."

Multiple sub-versions have been released, namely 5.1 and 5.2. Questions regarding specific sub-versions of Ruby on Rails 5 can also be asked on the appropriate tags:

Resources:

See also:

9415 questions
31
votes
5 answers

Rails 5 ActionController::InvalidAuthenticityToken error

I have a rails application which I am planning to upgrade to rails 5. I am using devise(v4.2.0) along with rails(v5.0.0). As suggested in devise README.md file, I tried moving the protect_from_forgery above the before_filter but still when I am…
H D
  • 603
  • 1
  • 8
  • 26
30
votes
3 answers

How do you convert a Rails 5 API app to a rails app that can act as both API and app?

I initially created it in rails 5 with the --api tag. From http://edgeguides.rubyonrails.org/api_app.html, I removed config.api_only = true I changed class ApplicationController < ActionController::API end to class ApplicationController <…
Laser
  • 5,085
  • 4
  • 34
  • 48
29
votes
8 answers

Rails 5 how to clear or delete production postgres database

I am trying to delete a production database so I can start fresh. When I upgraded to rails 5 from rails 4, it is now protecting the production database from accidental deletion. It shows the following error message when I run rake db:reset. /app#…
Scott B
  • 1,478
  • 2
  • 16
  • 26
28
votes
4 answers

Rails 5: How Do I Set Up a Merge Tool to use for rails app:update?

I'm upgrading a rails 5.2.4.1 app to rails 6. There are a few config files I want to merge instead of manually adding information from a copy of the old file. The first time I entered m to merge the file I got the following message. Please specify…
27
votes
3 answers

Rails 5 ignoring /lib class?

I've used this method for modals in rails. It works really well, but I've just upgraded to Rails 5 beta3, and now it's not working in production. I get this error: Completed 500 Internal Server Error in 22ms (ActiveRecord: 0.9ms) NameError…
Kevin Brown
  • 12,602
  • 34
  • 95
  • 155
26
votes
7 answers

Omniauth-twitter with Rails 5 stopped working! OAuth::Unauthorized 403 Forbidden

Everything was working fine and Omniauth has stopped working suddenly. I didn't make any code changes. I checked Twitter Apps Settings: I have callback url to my main production url, and Callback URL Locked to No. All keys are correct. Any idea?…
Designer
  • 1,061
  • 1
  • 12
  • 26
26
votes
9 answers

ActionCable - Failed to upgrade to WebSocket in production

ActionCable doesn't work in production. Works well in development, but not in production. Running Nginx with Puma on Ubuntu 14.04. I have checked that redis-server is up and running. Rails -v 5.0.0.1 production.log: INFO -- : Started GET…
mityakoval
  • 888
  • 3
  • 12
  • 26
26
votes
2 answers

index: true vs foreign_key: true (Rails)

Following a guide, I ran the following command: rails g migration CreateSnippetsUsers snippet:belongs_to user:belongs_to This created the following migration: class CreateSnippetsUsers < ActiveRecord::Migration[5.0] def change create_table…
Mirror318
  • 11,875
  • 14
  • 64
  • 106
26
votes
5 answers

Rails server doesn't see code changes and reload files

I noticed that my rails server doesn't reload controllers, models and probably any other files after I change them. I use Vagrant and Rails API, and I found that some people fix this problem by adding below line to the…
mparkitny
  • 1,165
  • 1
  • 9
  • 16
26
votes
4 answers

NameError: uninitialized constant Faker

I am trying to run a simple bundle exec rake db:seed for my database in Rails 4. However, when running it, I get the following output: ********-C02MGBVJFD57:myapp ***********$ bundle exec rake db:seed Your Gemfile lists the gem factory_girl_rails…
user1072337
  • 12,615
  • 37
  • 116
  • 195
26
votes
4 answers

rescue_from ActionController::RoutingError in Rails 4

I've got the following error: ActionController::RoutingError (No route matches [GET] "/images/favicon.ico") I want to show error404 page for links that are not existing. How can I achieve that?
26
votes
5 answers

ActiveAdmin actions

is there a way to specify in ActiveAdmin's index page of a model what actions are allowed, things like: index do actions :edit end index do actions only: :edit end do not work. What's the correct syntax? Appreciated. bundle show…
25
votes
9 answers

stylesheet_pack_tag not finding app/javascript/src/application.css in rails 5.1 with webpacker gem

I am receiving this error when I try to load a page in my new rails 5.1 app using webpacker. I would like webpacker to handle CSS as well. Started GET "/" for ::1 at 2017-09-01 12:20:23 -0400 Processing by HomeController#welcome as HTML Rendering…
wuliwong
  • 4,238
  • 9
  • 41
  • 69
24
votes
7 answers

Rails 5.1 run system tests and normal tests with one command

In Rails 5.1, you can do bin/rails test to run normal tests, and bin/rails test:system. What is the Rails sanctioned way of running both at the same time?
chrismanderson
  • 4,603
  • 5
  • 31
  • 47
23
votes
3 answers

Webpacker in Rails 5 takes a long time to compile not that many files. How can I see what it's doing?

[Webpacker] Compiling… It takes several seconds (6.2 seconds) to compile any of my changes to javascript files. It's really slowing my JS development down. Is there any way to see what Webpacker in Rails is doing and which files it's spending most…
cmrichards
  • 1,725
  • 1
  • 19
  • 28