Questions tagged [ruby-on-rails]

Ruby on Rails is an open source full-stack web application framework written in Ruby. It follows the popular MVC framework model and is known for its "convention over configuration" approach to application development.

0
votes
0answers
8 views

rails console rollback on create rails

I have a button called conversation when the user click on it, it creates conversation as record in the database. The issue is if there is 3 users userA, userB, and userC, if userB click on ...
1
vote
0answers
21 views

Ruby on Rails - Faraday SSLError wrong version number

I have an exception coming up on my production server when signing up using Devise. Everything was working fine before and no code has changed. The server is on Heroku. Here is the exception : "...
0
votes
0answers
10 views

Rails 5.2 Active Storage `mogrify -resize 1000x /tmp/mini_magick20190525-31-dbllb3.png` failed with error:

I just started using Active Storage with S3, after uploading and then trying to access a variant with rails_representation_url(object.image.variant(resize: '1000x')) I occasionally get the following ...
0
votes
0answers
19 views

how to copy a object with rails

I would like to use deep_dup to duplicate the parent and child objects and save as a new record using rails 5. I have been searching to see some example code to implement it on my project but so far i ...
0
votes
0answers
19 views

will_paginate call firing as HTML instead of JS

An application has two actions from the same controller where AJAX calls are made to refresh collections of the same class. In one case, the observed response is via XHR, the other returns HTML. Both ...
-1
votes
1answer
23 views

I want to update my column attributes names without changing their values

1.I want a query to update my column attribute names without changing my attribute values. This is what i have.... my table name is CheckIn and my column is name cravings: my attributes: `"Dairy ...
0
votes
0answers
10 views

Why does my paperclip configuration not work for?

I have a Photo model, I am running paperclip (>= 3.4.0), ruby 2.3.7, Rails 3.2. In my photo.rb, I have the following: class Photo < ActiveRecord::Base attr_accessible :position, :source_uri, ...
0
votes
1answer
23 views

How to fix 'ActionController::ParameterMissing" error in Rails?

I'm creating a quiz app, and want the form to send the user's answer to the controller, but can't get past this error. Most answers I've read appear to point to .permit and .require methods as the ...
0
votes
0answers
25 views

rails belongs_to migration file results in index is too long error [duplicate]

For some reason I have a rails app that's running perfectly fine on one system at the moment, but I cannot seem to migrate the database migration files on another system that's trying to replicate the ...
0
votes
0answers
21 views

changing cost amount to charge method to stripe depending on user selection in form

So i have a post model where users can upload post and it belong to a category and subcategory. Just like craigslist. I want users to have the option to promote products. For example if users pay $2....
0
votes
1answer
32 views

Meaning of Ynaqdhm?

I accidentally created a rails app that already exists (i.e. rails new existingapp) The terminal says Overwrite /Users/username/Desktop/existingapp/.gitignore? (enter "h" for help) [Ynaqdhm] ...
0
votes
2answers
24 views

Having trouble submitting nested resource through form [Rails 5]

I have a Document that has_many Section, and each section has_one Comment. I want to be able to create both sections and comments in the Document show view, but I'm having trouble getting comments to ...
0
votes
1answer
19 views

Routes match error upgrading from 2.3 to 5.2.3

I am upgrading an app from Rails 2.3 to Rails 5.2.3 and ran into an error with match in routes.rb Error I get is: ActionController::RoutingError (No route matches [POST] "/"): actionpack (5.2.3) lib/...
1
vote
1answer
17 views

Extending modules dynamically in Devise

I am learning more about dynamically including and extending modules using metaprogramming and I found an article discussing the implementation of #included in the Devise gem. To include devise ...
0
votes
1answer
28 views

Is it possible to insert data into two different tables inside one controller

I have this tables which names are Users table and Pictures Table whose primary job is to store the picture path and name and user id(Am doing it this way because I want to ...
0
votes
0answers
13 views

Rails Carrierwave Cloudinary Video Upload Produces Invalid Version URLs

I have been using Carrierwave & Cloudinary in my Rails 5.2.1 application for client file upload, manipulation & storage. I'm adding video support and have hit a .url issue. A version converts ...
0
votes
1answer
17 views

How to use scopes in controller and views: Filter table by categories (enum) using scopes in Rails

I have an html table in my rails app where I sholl all my expenses. Expenses are an enum, which can take values like "education", "beer", "bliblablub". I would like to be able to filter my html ...
0
votes
1answer
29 views

How do I fix this one data pull?

Please help, I have one data pull that does not work with collection_select in rails 5.2 and I can not find what I have done incorrectly. New application using rails 5.2 and ruby 2.6.1, only this ...
0
votes
0answers
18 views

AMP with Ruby on Rails : Impossible to use a a Google Font

I am implementing AMP pages on my Rails app. However I can't get my font to work. It raises this error on the Google Search Console : "CSS syntax error in the "amp-custom style" tag. Incorrect ...
0
votes
0answers
21 views

NoMethodError in Instructor::CoursesController#create

When I tried to add image for new course, it popped up the error message undefined method 'courses' for <User:0x00007fb62c5cf5f0>. Could you please let me know what are the missing parts. Please ...
0
votes
1answer
14 views

Failing to update rails 5.1.2 to 5.2.3

I'm new to rails and I'm trying to updating rails in a project. I changed gem 'rails', '~> 5.2.3' for gem 'rails', '~> 5.2.3' in my Gemfile. Execute bundle update rails and got Bundler could ...
0
votes
0answers
15 views

Rails won't export to csv missing template

Missing template tunings/index, application/index with {:locale=>[:en], :formats=>[:csv], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :coffee, :jbuilder]}. Searched in: This error ...
0
votes
0answers
13 views

How does rack and frameworks like sinatra/rails work under the hood?

How do web servers, rack and frameworks like sinatra interact to process a request and response ? After reading the documentation, I was quite lost. It seems that both rack and sinatra has a call(...
1
vote
0answers
19 views

Routing post requests with a polymorphic comment table

I have a user and goal table that associate with a polymorphic comment table. My question is what's the best way to setup my comments controller to differentiate between the two? I'm looking more for ...
0
votes
3answers
18 views

Trying to select all objects where at least one associated object doesn't match the query

I have two associated models. A Product has many DescriptorFiles, and a DescriptorFile has a boolean attribute approved. I want to find all products where none of the associated descriptor_files are ...
0
votes
1answer
31 views

How to create custom update action before destroy object

I want to add update some field on my record before soft delete it. But I don't understand what I do wrong. Help me please to understand me wrong. controller.rb def set_the_reason @advert = ...
0
votes
1answer
17 views

Cannot eagerly load the polymorphic association :item

I need get all the accounts of the @client (has_many :accounts, as: :item is the relationship). Have a Account model with :item polymorphic field (belongs_to :item, polymorphic: true, nothing more), ...
0
votes
1answer
11 views

Pagination removes AR scopes in controller

Currently using api-pagination gem with kaminari. I also have a simple scope to limit the amount of objects returned. For whatever reason though, the pagination removes the return array of the scope ...
0
votes
0answers
16 views

Running gem tests

I am breaking a monolithic Rails app into several gems. They all have a load of features that depend on the main application. The purpose is to have a way to install the main application without all ...
0
votes
0answers
7 views

Recaptcha crashes digital ocean server (504 error)

getting 504s on DO when trying to add recaptcha via rails + devise I've added recaptcha on a digital ocean server. I followed the general instructions here -> https://github.com/plataformatec/devise/...
0
votes
2answers
21 views

How to do an RSpec oneliner to test a :count change

we all love oneliners, they are so cool but they are also so undocumented how can I do an oneliner of this code (that currently works brilliantly)? it "deletes the user" do expect { destroy_user }....
1
vote
2answers
28 views

passing a variable to an ActiveRecord query

Let's say I have a query: Foo.where("lower(bar) LIKE ?", "%#{baz}%") which transforms to plain SQL as: ... WHERE (lower(bar) LIKE ... and works perfectly. But instead of bar I want to pass an ...
0
votes
1answer
23 views

Association between 2 tables doesn't work

I'm new to RoR and I want to create simple page like a task manager (to add and remove tasks) so I created 2 tables with association between them (Track and Item). Here is 2 models: class Item < ...
0
votes
0answers
35 views

undefined method `text' for #<Enrollment:0x0000000005d124a0> [on hold]

I am facing this error: "undefined method `text' for #" when i am creating a new enrollment(table name enrollments). when i click on 'Add a new Enrollment' the error above appears. More infos in the ...
1
vote
0answers
12 views

What is ActiveStorage's 'attach' doing behind the scenes when files are uploaded to a service as like AWS?

I can't seem to find a detailed explanation of what process the attach method initialises when uploading a file (not direct upload) to a configured service such as Amazon S3. Does the file get ...
0
votes
3answers
19 views

Rails 5 left_outer_join with specific saved ID

I have a system with the following models class Application < ApplicationRecord has_many :offers, dependent: :destroy belongs_to :accepted_offer, class_name: 'Offer', ...
0
votes
1answer
25 views

Unable to resize image using image_tag (rails activestorage)

i'm using activestorage rails 5 in my project for uploading images when image uploads it did not resize to my given size in image tag. it only working with square images. help me i want to store ...
1
vote
1answer
26 views

How to encode RSA-OAEP with SHA256 hashing in Ruby or ROR

I am encoding a JSON data in Ruby by using RSA-OAEP with SHA256 hashing algorithm but I am not sure how to achieve in Ruby. I found a gem chilkat I have tried to encode the JSON data using Chilkat ...
0
votes
1answer
24 views

using an instance of appointment in the appointment model

I've created a form with some radio buttons and had to interpolate the appointment.id into the radio button and the label. However, Rails is throwing the error: undefined method cancel_3 for ...
0
votes
1answer
34 views

Dry-Validation - no implicit conversion of Float into String on rules

I'm trying to validate the value of a key into my schema. But I'm getting a no implicit conversion of Float into String because the value is a float and I'm using a regex to validate the format. ...
0
votes
2answers
60 views

How to interpolate in a ruby method name

Is it possible to interpolate in a method name? I'm trying to make this work def "cancel_#{appointment.id}" but having no luck. thanks
0
votes
0answers
21 views

how to have i18n working with shared partial caching

All my app have been transform to work with i18n but, the last thing i need is to cache the partails for each language. I've already seen some method to cache like this : <% cache([I18n.locale, ...
1
vote
1answer
24 views

Should I set explicit versions in a Gemfile?

I'm used to defining gemfiles with simple commands, like gem 'devise'. I'm now putting my App in production through a dockerized container on AWS, together with a pipeline that pulls and builds new ...
2
votes
1answer
38 views

Is there a Rubocop configuration specifically for rails 5.2.3?

I have just created a fresh Rails application using Ruby 2.6.3 and Rails 5.2.3 and the only thing I have done is installed Rubocop. After installing Rubocop v0.70.0, and running bundle exec rubocop ...
-1
votes
2answers
21 views

How can i get User name in a table where user_id is used as foreign key

I am using Devise gem for user Authentication. User id is as foreign key in article table How can i get writer name through User_id in a view Show_article.html.erb I can access user_id in ...
-1
votes
2answers
28 views

Rails migration to add a column of type array of objects

I would like to add a column of type Array of Objects. "users_to_employer":[ { key1 : value, key2 : value, }, { key1: value, key2: value, } ] I am ...
0
votes
0answers
22 views

Unable to access rails localhost running on AWS Ubuntu from my Windows desktop

I am running Rails server on an AWS Ubuntu instance. And I am trying to access the server from a browser on my Windows desktop. This used to work perfectly fine until yesterday. I started to get a ...
-1
votes
0answers
37 views

How to store zeros in db in rails

I have model with filed length - decimal , scale: 8, precision: 4. If I enter 5 in the field, there is 5 in the database. If I enter 4.4 in the database there is 4.4. But if I enter 4.500 in the ...
0
votes
1answer
21 views

Error on Rails app: Cannot stat '/path/to/app/current/passenger_wsgi.py': Permission denied (errno=13)

I've encountered something very strange. I've had a Rails app running on a nginx server on Centos 7 for over a year now, and it always worked. I checked back after a few months and I got this 500 ...
0
votes
0answers
16 views

uninitialized constant MetaTags when gem added in rails engine and loaded in another application

I am currently building a rails engine and in my gemspec file i have this gem meta-tags which i have added like this insurance.gemspec $:.push File.expand_path("../lib", __FILE__) # Maintain your ...

http://mssss.yulina-kosm.ru