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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
3 views

I can't to hightlight Rouge

rouge_helper.rb: module RougeHelper require 'rouge' def rouge(text, language) formatter = Rouge::Formatters::HTML.new lexer = Rouge::Lexer.find(language) formatter.format(lexer.lex(text)...
Vladimir Lozitskiy's user avatar
0 votes
0 answers
12 views

How to structure navbar with side bar in ruby on rails

Picture of my application In my application above I have a top navbar and a side bar. When a user click the sell tab in the topnav bar it directs them to the sell page which contains the sidebar, all ...
DAVID SAVON's user avatar
0 votes
0 answers
20 views

Getting issue in integrating this plugin template with the foreman

We're getting issue in integrating this plugin template with the foreman. We added plugin in /usr/share/foreman/plugins directory and added gem and it's path in /usr/share/foreman/bundler.d/Gemfile....
sachin mishra's user avatar
1 vote
1 answer
15 views

Create table with references to a composite primary key table

I created a composite primary key table: class CreateWines < ActiveRecord::Migration[7.1] def change create_table :wines, primary_key: [:name, :producer_id] do |t| t.string :name ...
John Fadria's user avatar
  • 1,885
0 votes
0 answers
9 views

ActionCable: is it possible to access connection information at broadcast time?

When receiving messages in ActionCable, we're given access to a connection object and we can get some useful information from it. As an example, this is part of the code I use to construct a log ...
Pathogen's user avatar
  • 845
0 votes
0 answers
20 views

Rails Runner scripts with double dash arguments throw Rackup error after Rails 7 upgrade

Following an upgrade to Rails 7.0.6 all the rails runner scripts we have in the script directory which accepted double dash style (like --year) arguments now throw an error regarding Rackup. Where ...
Chris Root's user avatar
0 votes
0 answers
16 views

Access Bootstrap 5 variables on Rails 7

Using Rails 7 and Bootstrap 5. I want other SCSS to be able to access Bootstrap variables, so that I don't have to redefine again. But with the following setup, I get Error: Undefined variable:. Here'...
Victor's user avatar
  • 13k
0 votes
1 answer
38 views

Assigning a numeric/epoch value to scheduled_at is deprecated in Rails 7.1

I'm getting a deprecation warning when upgrading to Rails 7.1 and Google has no search results! The warning is DEPRECATION WARNING: Assigning a numeric/epoch value to scheduled_at is deprecated. Use a ...
Phil-6's user avatar
  • 582
0 votes
0 answers
32 views

Rails 7 required: true attribute not working with slim-select

I am using Ruby 3 and Rails 7 in my application, and using Slim select through import map. config/importmap.rb pin "slim-select", to: "https://ga.jspm.io/npm:[email protected]/dist/...
Rahul Gupta's user avatar
-1 votes
0 answers
16 views

Integrating Pundit for Authorization and Implementing UI Restrictions in Redmine [closed]

Hello Stack Overflow community, I am working on a project where we are using Redmine as our project management and issue tracking tool. We want to implement fine-grained authorization using Pundit and ...
Aryan Tirkey's user avatar
0 votes
0 answers
14 views

Rails ActiveAdmin decimal validation with error message

I am creating a form for my admin page which goes like this: form do |f| f.semantic_errors f.inputs "Basic Details" do f.input :number f.inputs "Tests", class: "input-...
Ishmeet Singh's user avatar
0 votes
0 answers
23 views

Ruby on Rails 'NoMethodError (undefined method `check_url_response') [closed]

I'm working on a Ruby on rails SaaS application in which we integrate the 3rd party data like customers, orders, products from 3rd party in to our app mainly for providing marketing services to the ...
RGT's user avatar
  • 1
-1 votes
0 answers
15 views

validation error when calling regenerate token [closed]

I am using this this methods to destroy user session in controller. # logout user def destroy user.regenerate_token end Also I have validation in user model validates_presence_of :email, :...
Manav's user avatar
  • 569
-1 votes
2 answers
38 views

Ruby: ArgumentError (wrong number of arguments (given 1, expected 0)) [closed]

I'm clearly fundamentally not understanding how to pass arguments and call methods in Rails. I'm trying to make a test call to stripe with dummy information and I'm getting the subject error when I ...
John Gerard's user avatar
-1 votes
0 answers
19 views

Item index not compounding when I add new itens [closed]

When I add a new item on the edit page, the counting of the index stop adding after the third item and it puts "Item 3" no matter how many itens I create. I'm using cocoon to render new ...
Arthur Finamore's user avatar
2 votes
1 answer
25 views

Django models update related object when relation is updated

Ruby on Rails has a notion called touch. This is helpful in situations where you have objects linked via foreign keys and you want to conditionally update, say the parent's updated_at field, whenever ...
Keida's user avatar
  • 45
0 votes
0 answers
10 views

How to assign start and end date from range using Flatpickr in Ruby on Rails

I have been struggling for 3 hours as I have added mode: range in the Stimulus JS datepicker controller which works on display. On the logic though, I do not know how to reduce from two to one simple ...
Discopigeon's user avatar
0 votes
0 answers
32 views

Failed to load resource: the server responded with a status of 404 () why?

I am building an app in which the user can input cars into the API app and delete them, but I am getting a 404 error when trying to delete a car. what I don't understand is that I can access the car ...
Artur Gouveia's user avatar
0 votes
0 answers
33 views

Deep search for a value in a hash [duplicate]

I would like to analyze several hashes to extract certain specific information. These hashes have a global tree structure, however each of the branches of this tree structure is not always present in ...
h3lt3r-sk3lt3r's user avatar
0 votes
0 answers
26 views

jsonapi-resources: MySQL Error - 0.10.x, 0.11.0.beta2, Ruby on Rails

Jsonapi-resources: MySQL Error - 0.10.x, 0.11.0.beta2 Rails: 7.0.8 mysql2: 0.5.5 jsonapi-resources: 0.10.x, 0.11.0.beta2 We tried to implement jsonapi-resources into our project with MySQL DB. ...
Kubatron P's user avatar
0 votes
1 answer
14 views

How to localize an error message on a form object

Is it possible in Rails 7 to localize the attributes in a form object including ActiveModel::Model? I have the following class ProductionDataForm include ActiveModel::Model attr_accessor :...
Sig's user avatar
  • 5,546
2 votes
2 answers
38 views

Rails 7 + hotwire. Is it possible to turbo_replace form part not whole form?

I have no idea if is it possible to do. I have form for company Profile. Some data (17 fields in company_data partial) can be fetch using tax_number. Is is possible to replace turbo_frame '...
mateo's user avatar
  • 199
0 votes
0 answers
20 views

How to disable model validation pass check when showing a disabled element in simple form

I use Ruby On Rails in combination with the Simple Form gem. My validations in model looks like this validates :name, presence: true If I now have a disable input field for the name, then SimpleForm ...
Ymox's user avatar
  • 189
0 votes
3 answers
48 views

How to get keys from hash in Rails

In page.body I am getting this: page.body = "{\"error\":\"Sorry, that is an invalid URL\"} I want to fetch only "Sorry, that is an invalid URL". When I am fetching ...
Kumar Nikhil's user avatar
0 votes
1 answer
32 views

In "acts-as-taggable-on", how to get all the tags used in all the instances of a Model?

I have my model class described like this: class MyModel < ApplicationRecord acts_as_taggable_on :tags end How to get all the tags used by any instance of this model class? I tried: MyModel....
fguillen's user avatar
  • 36.3k
0 votes
0 answers
19 views

Customize devise error messaging to work with tailwindcss

The main problem, I cant figure out how to stylize devise error messages with tailwindcss. I can create my own stylized flash messaging, but then I cannot figure how to use that in place of devise's ...
christian torelli's user avatar
0 votes
1 answer
63 views

how can I forward all routing to a path in the public directory?

I have a javascript frontend application that lives in /public/app/ Basically, I just want to do something like: route.get '*', :to => '/public/app/index.html' so that going to any path will ...
patrick's user avatar
  • 9,304
0 votes
1 answer
43 views

My Ruby on Rails active record validation error does not persist when I re-render the same view

I'm using Rails 7 and Carrierwave to upload images. My image uploading is working as expected, but my issue is happening when I try to implement validation error message for an incorrect file type. In ...
Tony M's user avatar
  • 341
0 votes
0 answers
42 views

How can I permeate a value across instances without using class variables? [closed]

An issue that I keep finding myself facing as a new Ruby dev is the problem of what the best method is to permeate an important value without using a class variable. For example, I have the below ...
Will DeBernardi's user avatar
0 votes
0 answers
21 views

Error: PG::InvalidTextRepresentation: ERROR: invalid input value for enum status: "run" CONTEXT: unnamed portal parameter

I wanted to create a new Book but I am getting this error: PG::InvalidTextRepresentation: ERROR: invalid input value for enum status: "run" CONTEXT: unnamed portal parameter Since I made a ...
snloD's user avatar
  • 1
0 votes
1 answer
23 views

ActionText Trix Editor rails 7.0.7 won't load in production environment

I've created an action text editor with a rails 7.0.7 app, ruby 3.2.2 . The action text for works fine in development but it won't load in production. When I open up the dev tools it can't find trix ...
CJG's user avatar
  • 455
-1 votes
0 answers
24 views

SonarQube server [http://localhost:9001] can not be reached

On running sonar-scanner command on my rails project, i'm getting the below issue 22:59:00.604 ERROR: SonarQube server [http://localhost:9001] can not be reached 22:59:00.604 INFO: --------------------...
anshul mittal's user avatar
0 votes
1 answer
19 views

Rspec contexts running together when separate due to name

I have some tests like this context 'Main block' do let(:variable) { 'test' } pseudo and tests end context 'Main block two' do let(:variable2) { 'test2' } pseudo and tests end ...
James B's user avatar
  • 432
0 votes
1 answer
29 views

rails / stimulus / underscored controller name, problems to name via ruby data attributes

Given the controller awesome_app_controller.js, registered as awseome_app export default class extends Controller { static targets = ['input']; } The following : <%= content_tag(:div, nil, data: ...
Ben's user avatar
  • 5,042
0 votes
0 answers
16 views

Paper_trail gem stopped working when upgraded ransack to 4.0.0

In my rails 7.0.4 app I use: activeadmin 3.0.0 ransack 4.0.0 paper_trail 15.0.0 I have the page for filtering and sorting history of changes to the data: ActiveAdmin.register PaperTrail::Version do ...
mirelon's user avatar
  • 4,906
1 vote
0 answers
32 views

redirect_to doesnt take effect

I have a controller and inside the controller def publish post = Post.find(params[:post_id]) post.update(published: true, published_at: Time.now) redirect_to edit_post_path(post) end def ...
rubyongainz's user avatar
0 votes
0 answers
13 views

Error starting foreman with ruby version 3.0.5

Seems some conflict with ruby version? I have other app using ruby 3.2.2 and no issue running it. But with ruby 3.0.5 below error shows up. 🤔 % ruby -v ruby 3.0.5p211 (2022-11-24 revision ...
aldrien.h's user avatar
  • 3,497
0 votes
1 answer
33 views

Ransack Undefined method with predicates

Rails 7.1.0.beta1 ransack 4 Controller: @q = Customer.ransack(params[:q]) @customers = @q.result(distinct: true) View: <%= search_form_for @q do |f| %> <%= f.label :name %> <...
John Fadria's user avatar
  • 1,885
0 votes
1 answer
11 views

Rails 7.0.4 Turbostream does not refresh partial outside yield-block

I'm running rails 7.0.4. I use turbostream to refresh a content of the corresponding view without reloading all page. Everything goes well if I refresh content inside <%= yield %> block (nested ...
Stas Fly's user avatar
-1 votes
0 answers
15 views

Error while running rspec tests in parallel

I am using GitHub Actions to run the rspec test cases, lately, we have observed that our tests are taking a lot of time, close to 50 minutes, as the next steps we thought to run them in parallel, for ...
yadu singla's user avatar
0 votes
1 answer
21 views

ERROR: could not identify an equality operator for type json

I'm getting the error ERROR: could not identify an equality operator for type json when launching the SQL query update pdfs set forced_payload = datatable.forced_payload, s3_original_path = ...
Mathieu's user avatar
0 votes
2 answers
40 views

Does update action have instance variables in edit method? Ruby on Rails

Does update action have instance variables in edit method? I’m developing a form with validation, and would like to render edit form without deleting existing inputs. However, I got nill for the ...
Dilinger's user avatar
1 vote
0 answers
16 views

Rails direct upload with different buckets per model

My Rails direct upload with Stimilus Js is working fine, but now I have setup different bucket per model using service eg has_one_attached :avatar, dependent: :purge_later, service: :avatar and now I ...
r3b00t's user avatar
  • 6,993
1 vote
1 answer
58 views

How to clear a text field in a turbo stream view

I have a text field <%= form.text_field :my_field, class: "...", readonly: true, placeholder: "let's type" %> When I click an element, I wish to remove any value. To do so, ...
Sig's user avatar
  • 5,546
0 votes
0 answers
43 views

Rails Capybara Minitest with selenium — session not persisted within test

I'm trying to get Capybara working with selenium-webdriver for the first time, with a legacy app. We have Capybara tests working that use rack_driver, but trying to implement Selenium on the same ...
nimmolo's user avatar
  • 311
2 votes
0 answers
29 views

How do I handle client side routes, when a page refresh returns the backend rails' route instead?

I have deployed my SPA to Render. It consists of a React with Redux frontend, and a Rails backend. When the app mounts, it renders the correct frontend route in the browser, and any subsequent ...
holodiscus's user avatar
0 votes
0 answers
12 views

Rouge and redcarpet don't hightlight ruby code

In app/helper/application_helper: module ApplicationHelper require 'redcarpet' require 'rouge' require 'rouge/plugins/redcarpet' class HTML < Redcarpet::Render::HTML include Rouge::...
Vladimir Lozitskiy's user avatar
1 vote
1 answer
31 views

Rails pessimistic locking strategy not working in a Rails 7 / Postgresql app

In a Rails 7 app, with Postgresql database, I have a model Stat with a jsonb field data. I have a large concurrency happening, with several asynchronous processes which will add their own line in the ...
Arthur Vinson's user avatar
0 votes
0 answers
22 views

Accessing data via foreign keys

I have three models: Itasset, Location, Assetuser. An Itasset may have a Location. An Itasset may have an Assetuser. An Assetuser must have a Location. My models looks like this: class Assetuser < ...
PaulyC's user avatar
  • 1
0 votes
1 answer
25 views

Using a link_to with a null field

I have a model named hdasset which has a field called Warrantyexpiry. I'm trying to add a link to the index view as below: <td><%= link_to hdasset.Warrantyexpiry, hdasset %></td> ...
PaulyC's user avatar
  • 1

1
2 3 4 5
6749