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
4
votes
2 answers

undefined method `unserialize_attribute' in ruby on rails

I am working on upgrading rails application, I have a method unserialize_attribue in rails 3 but I am not able to see this method in rails 5. What is the alternative for unserialize_attribute in rails 5 or any suggestion on what can I do, Thanks
4
votes
2 answers

Workaround for content_for use in conjunction with fragment caching

I'm trying to insert content into the head of my page on an per element basis, so I'd like to be able to specify something like this in a partial: # _partial.html.erb <%= content_for :style %> .element { background-color: red; } <% end…
4
votes
1 answer

Joins with multiple tables/constraints OR has_one_through with secondary constraint

I apologise for the contrived example A person has ONE journey but is not directly connected to that journey, instead, they are connected via their house and office. A person belongs_to a house, a house has_many people A person belongs_to a office,…
Thermatix
  • 2,757
  • 21
  • 51
4
votes
2 answers

Active admin assets not compiling with webpacker

I am using webpacker for my asset pipeline in my rails app. I installed active admin as per the documentation. I moved the styleheet file and javascript file active_admin.js.coffee and active_admin.css from app/assets/stylesheets and…
4
votes
2 answers

Devise - bypass_sign_in without active_for_authentication? callback

I have functionality of inactive account in my application for handling this i override active_for_authentication? method as below def active_for_authentication? super && activated? end But In my application super admin can also directly login in…
Vishal
  • 7,113
  • 6
  • 31
  • 61
4
votes
0 answers

Communication of IoT device with server

I am using Rails 5.1.5. I have used nginx and puma for deployment of my app.Basically, I want to record all data sent by IoT device and store that data in one table.IoT device is using TCP for communication with server. so I have used stream…
darshi kothari
  • 642
  • 1
  • 5
  • 12
4
votes
2 answers

Rails 5.1: Foreign key mismatch for old rails schema

Context: On Rails 5.1 the default for Primary Keys changed from Int to BigInt (PR > https://github.com/rails/rails/pull/26266). I am working on a new Rails 5.1 app which reuses some models from another Rails 4.0 app. When I run the specs, I have a…
ascherman
  • 1,762
  • 2
  • 20
  • 41
4
votes
2 answers

locals not working for controller rendering in rails 5.1

I have a controller action that renders a printable version of the page using a print.html.erb template. The controller code is: def print @title = 'Print - Drill' render :show, layout: 'print', locals: { back_pth: drill_path(@drill)…
Obromios
  • 15,408
  • 15
  • 72
  • 127
4
votes
1 answer

How to view screenshot in terminal with rspec and rails 5.1

I am following this tutorial to test system specs with rails 5.1. If I deliberately fail a test, I get the following output in the terminal WARN: Screenshot could not be saved. `page.current_path` is empty. F Failures: 1) Homepage…
Obromios
  • 15,408
  • 15
  • 72
  • 127
4
votes
2 answers

ArgumentError in new for an enum parameter in rails 5.1

I have a model, Announcement, with an enum Audience = ['everyone', 'signed_in_only','visitor_only', 'app_only', 'exclude_app'] enum audience: Audience The announcements controller defines audience_params def announcement_params …
Obromios
  • 15,408
  • 15
  • 72
  • 127
4
votes
1 answer

Routes conflict in Ruby on Rails

I am working with Devise gem and I created a show page for users. My idea was to make a simple path like www.website.com/:id and I configured it as shown below: devise_for :users, path: '', path_names: {sing_in: "login", sing_out: "signout",…
Anton S.
  • 969
  • 1
  • 11
  • 29
4
votes
1 answer

jquery ui datepicker styles not rendered in Rails 5.1 app in production

I just deployed a Rails 5.1 application to the production server. Everything works fine, except that the CSS styles for the JQuery UI datepicker are not rendered. An unstyled calendar appears when clicking into a date field on the form. The other…
Toontje
  • 1,415
  • 4
  • 25
  • 43
4
votes
1 answer

`can't modify frozen Array (RuntimeError)` trying to update to Rails 5.1

I'm updating my rails app from 5.0 to 5.1 and when I start the app, it throws the following: ~/workspace/productswatcher ➜ rails s /files/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/react_on_rails-5.2.0/lib/react_on_rails/version.rb:3: warning:…
Alter Lagos
  • 12,090
  • 1
  • 70
  • 92
4
votes
1 answer

How can I require a Yarn package in the Rails assets?

I have installed the package progressbar.js using $ yarn add progressbar.js. Now I am trying to require it by adding //= require progressbar.js to my application.js, but that gives me an error every time I try to load a…
the-bass
  • 705
  • 1
  • 6
  • 20
4
votes
1 answer

ActionController::UnfilteredParameters (unable to convert unpermitted parameters to hash) - Rails 5

i have this error but not quite sure how to solve it. I have an API version module VI and my usercontroller module is like this class Api::V1::UsersController < ApplicationController def register ap params end def user_params …
Kingsley Simon
  • 2,090
  • 5
  • 38
  • 84