ruby-on-rails-5 Questions

4

Solved

I have created a model Tester with integer column tester_type and declared enum variable in the model. class Tester < ApplicationRecord enum tester_type: { junior: 0, senior: 1, group: 2 } en...
Statue asked 18/12, 2017 at 6:26

6

Solved

There's a function called index_exists? in ActionRecord, but no foreign_key_exists? on Rails 4.2.7. So when I call remove_foreign_key :parties, :franchise_groups on some databases it breaks. Wha...

4

I am trying to avoid string interpolating my joins in Rails because I've noticed a decrease in flexibility when chaining queriers together. That is, I feel that joins(:table1) is much more flexib...
Wyattwyche asked 27/2, 2018 at 20:40

8

Is it possible to add a validation to accept only .pdf and .doc files using Active Storage?
Mead asked 19/1, 2018 at 20:30

1

This question may seem like a duplicate of this one but the accepted answer does not help with my problem. Context Since Rails 5 no longer supports directly manipulating sessions in controller te...
Systematism asked 30/3, 2017 at 8:35

8

Solved

I've been developing an app using Webpack, Vue.js and Rails. No problems for two months, but out of nowhere when I try to start rails console rails c, yarn complains that packages out of date: err...
Idonna asked 2/4, 2018 at 11:35

3

Solved

I have an annoying view problem that I'm trying to debug and no where on the Haml Documentation Haml Docs does it specify how to debug view code. This is very annoying and all I need is to debug a ...

2

As described, I updated my Rails from v4 to v5.1.5 by updating the version in the Gemfile and running rails app:update. I'm getting the following error that crashes my server whenever I try to load...
Laspisa asked 6/4, 2018 at 6:4

2

Solved

I have to build a docker image on my local machine to verify whether it is a building an image or not but I am facing this issue while building the docker image on a local machine. Installing mime...
Bullnecked asked 2/4, 2021 at 5:39

10

Solved

While I realize you are supposed to use a helper inside a view, I need a helper in my controller as I'm building a JSON object to return. It goes a little like this: def xxxxx @comments = Array.n...
Osset asked 26/2, 2011 at 22:31

3

I've just set up a Linux Mint box for rails development with rvm. I went ahead and generated a Rails 5 app, set up the mysql connection, added the cucumber-rails gem and then tried to run: rake cu...
Clupeoid asked 14/1, 2017 at 10:42

2

Solved

In Rails 5.2.3, I need to render a partial which takes an optional block. # users/_user.html.erb ... <% if block_given? %> <%= yield %> <% else %> <h1>Goodbye world</h...
Unmeet asked 22/10, 2019 at 19:24

2

Solved

Of the scarce instructions I've read about adding Postgres's data type jsonb in a migration, it's looking like this: create_table :ref_check_ins do |t| t.jsonb :document, null: false, default: '{...
Schaffhausen asked 3/6, 2016 at 13:55

2

Solved

I am running a Rails 5.0.0 app with Ruby 2.3.1 Sidekiq is being used for background jobs and devise for authentication. Sidekiq monitoring and devise are mounted in routes as follows: devise_for...

5

Solved

I have a Rails 5 API app (ApplicationController < ActionController::API). The need came up to add a simple GUI form for one endpoint of this API. Initially, I was getting ActionView::Template::E...
Nubilous asked 14/3, 2017 at 19:50

5

Solved

When I am running server its throwing error shown in logs below. I googled a lot but didn't get reason behind it. Somebody please put some light on it. Gemfile source 'https://rubygems.org' # Bu...
Katheleenkatherin asked 21/12, 2015 at 12:43

5

I'm trying to perform database related operations on my newly upgraded app(Rails 5) and I'm unable to perform destructive database commands locally. rails db:reset or rails db:drop . The trace res...
Misbecome asked 28/8, 2017 at 18:37

2

I am building a website using Ruby on Rails. To upload images I am using Active Storage and Amazon S3. All's good here. Users can upload images and images are viewable on the website (images are pu...

2

Solved

With activerecord (< 5.0, >= 3.2) I was able to use the activerecord-mysql-unsigned gem to create an UNSIGNED INT in my MySQL database, but there's been no updates to that gem and I can't fin...
Boarfish asked 27/11, 2017 at 2:14

1

Solved

I do this tutorial https://www.digitalocean.com/community/tutorials/build-a-restful-json-api-with-rails-5-part-one But when running the RSpec test at the chapter Models, I get the following error. ...
Merrymaker asked 26/1, 2021 at 8:37

3

Solved

Building websockets app based off of actioncable-examples. When starting server, running rake, etc. I keep getting the message: Array values in the parameter to `Gem.paths=` are deprecated. Have...
Galang asked 16/6, 2016 at 15:57

3

Solved

Having server issues with an app in Rails 5.0.0.beta2 trying to use ActionCable. Using localhost:3000 works fine, as that is what most of ActionCable defaults to. But if I try to run the rails ser...
Melgar asked 3/2, 2016 at 22:21

2

Solved

Whenever sending malformed JSON against my API-only Rails 5.x application, I get an exception and Rails is returning the entire stack trace as JSON. Obviously I'd like to respond with a nicely, cus...
Disabled asked 26/10, 2016 at 16:57

2

I've created a rails API project (Rails 5) to be the back end for my mobile application, but i would now like to create some administrative functions that I can access directly from a browser. I'm...
Ripplet asked 6/12, 2017 at 4:21

4

Solved

I'm totaling the rows in one of my models using Model.count and am a bit concerned about performance, as eventually, this model will get very large, and, therefore, SELECT COUNT (*) very slow. Is t...
Corkwood asked 12/5, 2011 at 1:4

© 2022 - 2024 — McMap. All rights reserved.