ruby-on-rails-5 Questions
5
Solved
I tried SecureRandom.random_number(9**6) but it sometimes returns 5 and sometimes 6 numbers. I'd want it to be a length of 6 consistently. I would also prefer it in the format like SecureRandom.ran...
Dunigan asked 17/5, 2017 at 17:20
2
I'm trying to change a function — which currently only accepts a URL (path) string — to make it more flexible, so that it will also accept as input the same arguments that you can pass to url_for. ...
Vaquero asked 8/1, 2019 at 5:28
8
Solved
I want to get list of records with attached images as a links or files by api.
I have a simple model:
class Category < ApplicationRecord
has_one_attached :image
validates :name, presence: tr...
Pena asked 9/6, 2018 at 15:11
4
Solved
As far as I know, assign_attributes (unlike update_attributes) is not supposed to save the record or for that matter, any record.
So it quite startled me when I discovered that this is not true wh...
Chelseachelsey asked 29/6, 2017 at 7:57
4
Solved
So I decided to add an url attr_accessor to ActiveStorage::Attachment objects.
In development the patch holds for a while until it seems to "have been lost". Meaning it works for few minutes, then...
Acrimonious asked 11/3, 2019 at 20:17
11
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...
Voiture asked 25/11, 2016 at 14:10
6
Solved
Before migrating to rails 5 it was working nicely, but when I migrated to rails 5.1.1 it is giving me error like
ActiveSupport::MessageVerifier::InvalidSignature:
ActiveSupport::MessageVerifie...
Centeno asked 3/11, 2017 at 13:17
5
Solved
I have a Rails 5.2.3 app using ActiveStorage. By default, ActiveStorage would run some background jobs to extract metadata from attached files, and/or create thumbnail images for previews.
I don't...
Leopoldine asked 4/6, 2019 at 14:23
3
I have a piece of code where I import a BankAccountTransaction to a BankAccount
bank_account.with_lock do
transactions.each do |transaction|
import(bank_account, transaction)
end
end
it wor...
Faller asked 25/3, 2019 at 13:39
3
Solved
I have access to
config.action_dispatch.encrypted_cookie_salt
config.action_dispatch.encrypted_signed_cookie_salt
secrets.secret_key_base
the full cookie string (including --)
I see ways to do ...
Reactant asked 4/1, 2017 at 22:19
9
Solved
To get a single random record from the db, I'm currently doing:
User.all.sample
But when there are 100000+ users, it takes a few seconds to load them all, just to select one.
What's the simplest...
Ulloa asked 28/3, 2018 at 3:56
4
Solved
I am using active_admin. I am trying to make a form field required in activeadmin:
input :team, as: :select, required: true, collection: Team.all.pluck(:name, :id), include_blank: "Please enter a...
Reversal asked 13/7, 2017 at 17:3
4
Solved
I have created a simple Rspec test to verfiy if a model created has been deleted. However, the test fails because the model still exists. Can anyone provide any assistance on how to determine if th...
Ameeameer asked 8/2, 2021 at 19:39
4
In development environment, rails logger logs all ActionCable events which is sometimes annoying (for my project, every now and then it's transmitting messages and log tail is running like wild hor...
Trophic asked 14/7, 2016 at 5:21
2
Solved
I have a problem with rspec behavior. I try to write test for service where I use session, for read some value and overwrite this value.
For example what I want to test
class CurrentCartService
...
Scarlet asked 7/4, 2019 at 15:17
21
Solved
I'm working with heroku and every time I try to push my app this message shows out:
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
...
Tidewater asked 9/11, 2018 at 18:46
7
Solved
I am using friendly_id in my rails 4 application with slug. Now I am using active_admin gem.
Problem:
When I click on show link from active admin for Group resource, It is throwing the following ...
Subbase asked 20/11, 2014 at 6:9
13
Solved
I've upgraded one of my apps from Rails 4.2.6 to Rails 5.0.0. The Upgrade Guide says, that the Autoload feature is now disabled in production by default.
Now I always get an error on my production...
Inquietude asked 5/7, 2016 at 8:30
8
Solved
When I do bin/rails credentials:edit my editor opens a file like credentials.yml.enc.1234 with default content. After I'm done editing, I hit save, and the console reads New credentials encrypted a...
Murky asked 31/1, 2018 at 10:4
1
I have a rails app and I'm sending email through Mailgun smtp
mail(
to: @user.email,
subject: 'Notification From ME',
'X-Mailgun-Variables' => { subscription_id: subscription.id }.to_json
)
...
Euphemia asked 4/10, 2017 at 16:55
2
Solved
I never understood why one has to use ActiveSupport::Concern is used for mixins instead of a plain module. Is there a simple answer to what ActiveSupport::Concern provides (at least in Rails 5) tha...
Svetlanasvoboda asked 26/11, 2018 at 20:26
2
Solved
Imagine the scenario that there is a controller integration test calls a controller method, in which cookie.signed is used for some integrity checking.
Controller
# app/controllers/foo_controller...
Autopilot asked 29/4, 2017 at 1:3
5
Solved
I just upgraded my app from Rails 4.2.7 to Rails 5.0.0.1. I used RailsDiff to make sure I had everything covered and I believe I did. So far everything has worked well up until the loading of my ap...
Velum asked 2/9, 2016 at 14:30
6
Solved
I know this is a old question but no answer is fixing my problem.
I'm new to Ruby on Rails and just created project with a PostgreSQL database just to be able to upload the project to Heroku.
When ...
Amphiarthrosis asked 15/6, 2019 at 21:5
2
Has anyone experienced this? We upgraded a project from Rails 5.2 to Rails 6.0.0 and after this, the memory consumption skyrocketed... In the release candidate environment, it works fine, but in pr...
Bulimia asked 13/9, 2019 at 17:46
1 Next >
© 2022 - 2024 — McMap. All rights reserved.