Questions tagged [ruby-on-rails-5.1]

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

Ruby on Rails 5.1, "an open-source web framework that's optimized for programmer happiness and sustainable productivity." Rails 5.1 brings a bunch of new features and improvements over older Rails versions.

Major Features

  • Yarn Support
  • Webpack
  • Encrypted secrets

See Ruby on Rails 5.1 Release Notes for more information.

Resources

Related tags

397 questions
2
votes
0 answers

Configuration blocks in a Rails initializer don't work with local-path gems (?)

In my Rails app Gemfile, I have gem 'myfancygem', path: '/Users/matt/myfancygem' This works as you'd expect. I then added a configuration block feature to the gem, a la https://robots.thoughtbot.com/mygem-configure-block (and many others out there…
2
votes
1 answer

Why is db:structure:load failing with "operator family "btree_hstore_ops for access method btree already exists"?

My Rails 5.1 CI tests have started failing with the following error: bundle exec rake db:create db:structure:load Created database 'my_test' psql: .../structure.sql:72: ERROR: operator family "btree_hstore_ops" for access method "btree" already…
Andy Harvey
  • 12,333
  • 17
  • 93
  • 185
2
votes
1 answer

Rails 5.1 store cryptocurrency values in postgresql database

i want to make a rails app to keep track of my cryptocurrency coins. How would you save the values in the database? Which datatype field would you choose? I thought about using the rails-money gem, but only BTC (Bitcoin) is set as a currency. Thanks…
user993460
  • 821
  • 2
  • 8
  • 8
2
votes
1 answer

Rails 5.1 scaffolded create method returns status 200 on failure

In using the rails 5.1.4 scaffolding for controllers I see that the default approach to deal with a save failure in the #create method is to render #new again (with a status of 200). respond_to do |format| if @company.save format.html {…
krsyoung
  • 1,171
  • 1
  • 12
  • 24
2
votes
1 answer

rails 5 run script only after server start

I want to run a ftp listener class only when the server starts and not when console, generators, dbconsole, test, destroy, runner and rake commands run. I've found some people doing same thing with rails 3 and 4 using checks like defined?…
Subash
  • 3,128
  • 6
  • 30
  • 44
2
votes
1 answer

Rspec swallowing Postgres database exception on create

I have trouble understanding the behavior of Rspec (rspec 3.7, rails 5.1.4) not throwing exceptions (as expected) related to database constraints. Assuming one creates a table with a not null constraint on a association something like…
count0
  • 2,537
  • 2
  • 22
  • 30
2
votes
0 answers

Fancybox gem rails 5.1

Currently, it seems that for Rails 5.1 we do not have any compatible Fancybox gem Latest Fancybox3 is compatible with rails 5.0 but not 5.1 (https://github.com/fobiasmog/fancybox3/issues/3) . I am upgrading my application from Rails 4.2.7 version…
2
votes
0 answers

How to serve specific JS and CSS files for each view in Rails 5.1

I've been using Rails 3.2 for a project. I'm now building a new project with Rails 5.1. I use the M & C parts of Rails extensively and almost ZERO of the View. This is because I use a JavaScript UI library from a 3rd party vendor - DHTMLX. They…
nexar
  • 11,126
  • 3
  • 29
  • 32
2
votes
1 answer

Howto Uninstall spree_auth_devise gem

I have an existing Rails 5.1 application which already contains a custom user controller. As I was following the instructions to install Spree, I installed the spree_auth_devise gem and ran the migrations and other install commands as advised on the…
Carl
  • 1,246
  • 3
  • 21
  • 39
2
votes
1 answer

respond_with having issue with Rails 5

I am upgrading my Rails app from 4.1.1 to 5.1.4. I am using roar-rails gem to parsing and rendering REST documents. I am facing some issues as responders gem has been extracted to separate gem. respond_with has been moved to 'responders' gem. My…
2
votes
1 answer

Facing an issue with Ios Notification which is not receiving at device. Same setup is working fine with Android

Using fcm for push notification ios and Android Request: fcm = FCM.new(ENV["FCM_TOKEN"]) options = {data: {message: message}, priority:'high'} response = fcm.send(device_tokens,…
2
votes
0 answers

Why I'm getting frequent 504 Time out error?

my nginx configuration is as: upstream app_server { server unix:/run/DigitalOceanOneClick/unicorn.sock fail_timeout=0; } server { listen 80; root /home/rails/rails_project/public; server_name example.com…
codemilan
  • 1,072
  • 3
  • 12
  • 32
2
votes
3 answers

undefined method `page_path' rails

Rails 5.1.3 I have a namespaced set of routes in my route file within rails: Rails.application.routes.draw do get 'page/index' namespace :admin do resources :pages resources :sections end get '*page', to: 'page#index' root…
user1400312
2
votes
1 answer

Rails 5.1 - ActiveRecord::RecordNotUnique.new wrong number of arguments

Upgrading from Rails 4 to Rails 5.1. Have this running rspec test: Failure/Error: let(:exception) { ActiveRecord::RecordNotUnique.new("oops", Mysql2::Error) } ArgumentError: wrong number of arguments (given 2, expected 0..1) It seems the syntax…
xxjjnn
  • 14,591
  • 19
  • 61
  • 94
2
votes
1 answer

React with Rails 5.1 Calling Database Objects into React Components

How do you call a Rails 5.1 database object into a React component? For example, in a standard Rails view, I can call an object using @object assuming I have access to it configured in the controller. With Rails 5.1, using the Webpacker enabled…
JohnOHFS
  • 174
  • 14