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
0votes
0answers
4views

How to solve tzinfo error on ruby on rails?

Trying to learn ruby on rails and I keep coming up with this error: rails aborted! TZInfo::DataSourceNotFound: tzinfo-data is not present. Please add gem 'tzinfo-data' to your Gemfile and run bundle ...
user avatar
0votes
0answers
3views

Devise authentication and linking social accounts with omniauth

I have an app set up to use Devise for authentication. I am wanting users to be able to link their social media accounts after they have logged in via my devise setup. I am not looking to allow them ...
user avatar
  • 315
0votes
0answers
9views

ArgumentError when trying to save multiple records in Rails

What we want to achieve I am sending an array from Nuxt.js, Rails is in API mode and I am getting an error when I try to retrieve and save the array contents one by one. I want to save the array ...
user avatar
  • 169
0votes
0answers
8views

Rails: Run raw sql query returning extra info and build models

In rails how can I get raw sql results from the database and then turn part of them into active record objects. More specifically, suppose I have a select statement like: "SELECT comments.*, c1....
user avatar
0votes
0answers
13views

How to extract information from the database in Heroku?

I have a rails app deployed in heroku. The app has a HTML form that gets input from people visiting the website. How do I extract the information for the form from Heroku? I have tried going to Heroku&...
user avatar
0votes
0answers
5views

AttributeError: 'Box' object has no attribute 'shape' Error

lib/python3.7/site-packages/stable_baselines/common/input.py", line 25, in observation_input observation_ph = tf.placeholder(shape=(batch_size,) + ob_space.shape, dtype=ob_space.dtype, name=name) ...
user avatar
0votes
0answers
16views

How to add Tooltip on field Label in ruby on Rails form?

I've been trying to solve this problem but can't come up with a good solution. Basically I have this field in my form: <%= f.text_field :name, :label => "Name", :class => 'autofocus'...
user avatar
  • 1,187
0votes
0answers
11views

undefined method `javascript_pack_tag' for #<ActionView::Base:0x0000000000a730>

I am currently working with webpacker currently shakapacker. The structure of my generated app using rails new react-app --webpack=reactis app/javascript/application.js and not as shown below I have ...
user avatar
0votes
0answers
9views

Using Devise + OmniAuth for Twitter OAuth 2

I'm using devise (4.8.1) and omniauth-twitter and I have "Login with Twitter" working. A user can sign in (a User is created if it doesn't exist yet), the session is persisted and I can ...
user avatar
  • 538
-3votes
0answers
26views

HEROKU We're sorry, but something went wrong [closed]

I have deployed my rails application on Heroku, authentication works fine but when I click on create a enter image description herepost I get this error. is there anyone to help me, please
user avatar
0votes
1answer
19views

Two identical ERB expressions for different routes yielding different results

I'm running into a problem with a Rails 7 app. I have the following routes defined: Rails.application.routes.draw do # Defines the root path route ("/") root "site#index" # ...
user avatar
  • 150
0votes
0answers
11views

Rails Rich Text (Trix) return NoMethodError: undefined method `render' for nil:NilClass

When I try to run a rake task, Trix return this error NoMethodError: undefined method "render" for nil:NilClass in this file: /bundle/ruby/2.7.0/gems/actiontext-6.0.0/lib/action_text/content....
user avatar
0votes
1answer
22views

How to detect mime type of file in Rails in 2022?

Is there a built in way in Ruby/Rails to detect the mime type of a file given its URL, and not relying on its extension? For example lets say there is an image file at an external URL that I want to ...
user avatar
  • 2,253
0votes
1answer
28views

With Ruby on Rails what's the best way to display data from a form field on a show page from another Ruby class?

I'm still somewhat new to Ruby and am having trouble displaying data on the show page from another class. I have two classes, Company and Job. On the Job show page I would like to display the Company'...
user avatar
  • 1
0votes
0answers
7views

Turbo performance benefit confusion, application teardown

I'm unsure about this last sentence in the first paragraph of the Turbo docs. A key attraction with traditional single-page applications, when compared with the old-school, separate-pages approach, ...
user avatar
  • 1,084
0votes
0answers
16views

NameError in CategoriesController#create undefined local variable or method `category_params' for #<CategoriesController:0x00007f9df7d0ace0> [closed]

I am getting this error when I create my categories: NameError in CategoriesController#create undefined local variable or method `category_params' for #CategoriesController:0x00007f9df7d0ace0 Did you ...
user avatar
  • 1
0votes
1answer
21views

Rails protect_from_forgery has not been defined

I'm new at rails so maybe this is so basic and that's why I couldn't find anything about it. But anyways I stuck at here and I need help. I updated a rails 4 application to rails 6 and when I try to ...
user avatar
0votes
0answers
9views

Rails 4: Schema from MSSQL to SQlite?

So im running into a bit of an issue, im working on a rails 4 project that has basically a portion of migrations/schema used for that project, the rest of the "core" models/schema is kept ...
user avatar
  • 2,099
-1votes
1answer
40views

In ruby on rails how to change table format

hi I am new to rails pls need help. Table data from index.php.erb <table class="table"> <thead> <tr> <th>Area</th> <...
user avatar
  • 1
0votes
0answers
16views

How to pass active storage images to email

I am using active storage in my Rails application. The frontend is on React. I am uploading an image via react uploader and sending that image to the backend API where I am storing it to S3 bucket ...
user avatar
0votes
0answers
16views

Couldn't find any packages in ["bootstrap"] on jspm on Rails 7 importmap

This suddenly happen when I tried ./bin/importmap pin bootstrap while it did not happen before (worked fine with my 2-3 previous applications I made for experiment) What I did is like installing ...
user avatar
0votes
1answer
22views

Rails 7 authenticate returns 'invalid hash'

BCrypt is active Model : has_secure_password Rails 7.0.2.3 Ubuntu 20.04 via WSL2 Windows 10 I can create, but I can't authenticate the passwords. When trying this following in the Rails Console I end ...
user avatar
  • 117
0votes
0answers
23views

Adding an attribute to json from joined table

I am trying to provide a json that would contain information coming from two tables:MenuItem, and Partner. In the json below "partner_number" would actually come from the partner table. { ...
user avatar
  • 39
0votes
0answers
9views

How to define within scope for (hidden) div with id-tag (capybara testing)?

Does somebody know how i use the visible option in a within to define a scope within a tagged div like <div id="contact-persons" class="row"> so that my testing scope for ...
user avatar
0votes
0answers
23views

how to fix Errno::EACCES: Permission denied @ dir_s_mkdir -

when I tried bundle install Errno::EACCES: Permission denied @ dir_s_mkdir - /Users/noah/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/extensions/arm64-darwin-21/2.7.0/racc-1.5.2 An error occurred while ...
user avatar
0votes
0answers
21views

rails aborted! LoadError: cannot load such file -- Win32API Did you mean? win32/sspi

This issue occurs only when my database is mysql2. i try to install gem install win32api but is not working my gem file source "https://rubygems.org" git_source(:github) { |repo| "...
user avatar
0votes
1answer
25views

Issues regarding new Ruby On Rails Application

I attempted to make a new app using rails new command and the bundle is completed. However, it said that rails aborted! and appeared another error: Bundle complete! 15 Gemfile dependencies, 70 gems ...
user avatar
0votes
0answers
14views

Rails 7 Heroku Deployment Issue with Sprockets::DoubleLinkError after accidentally installing importmap

I just tried git push heroku my application after accidentally installing importmap. Already removed files in the build folder but nothing fixed. Sprockets::DoubleLinkError: Multiple files with the ...
user avatar
0votes
0answers
5views

How do I stop Yarn from looking continuing to look for removed modules in rails 6

When i run yarn it errors out on node_modules/node-sass/... but I already removed that directory from node_modules All lock files have already been removed but I still get errors from nvm node v16 Why ...
user avatar
-2votes
0answers
14views

Converter letras do meio da frase em maiúsculas [closed]

Boa noite, sou novo na programação e estou fazendo uns desafios de RUBY. Preciso converter algumas letras no meio da frase em maiúsculas. Exemplo: ruby on rails> converter para >rUbY On rAiLs ...
user avatar
  • 1
-1votes
1answer
10views

Bootstrap 5 Aligning Items In Navbar

<nav class="navbar navbar-expand-lg navbar-dark bg-dark"> <%= link_to "My Ozone", root_path, class: "navbar-brand" %> <button class="navbar-...
user avatar
0votes
0answers
16views

Puma - How to bind HTTP and HTTPS to the same port? localhost

I need to support both http://localhost:3000/ and https://localhost:3000/. The following config does not work. How can I bind both protocols? ... ssl_bind "127.0.0.1", rails_port bind "...
user avatar
  • 2,928
0votes
1answer
21views

Ruby on Rails - Limit Database Query to One Result only

I want to query the database but only find out if there is at least one result or not. I am trying to minimize the cost for this transaction. What would the structure be in Rails to have the query be ...
user avatar
0votes
0answers
13views

Ruby on Rails Bundle Gems error Windows 10

After create a new project I exec bundle install --force to install remaining gems Gem version : 3.3.10 Rails version : 7.0.2.3 After Run rails new error: mingw32: clave «...
user avatar
0votes
0answers
13views

NoMethodError in Solidus when using external storage service

I have a vanilla Solidus installation (ruby 3.0 | rails 6.1.5) I'm using the edge guide to test a deployment on Heroku. I get the following error on my local machine if I configure active storage to ...
user avatar
  • 90
0votes
0answers
16views

Connect to process running Rails console

I have a Rails console running in a process on my server (bundle exec rails c) and I'd like to be able to SSH into that server and "connect" to that process, as if I had started the Rails ...
user avatar
0votes
0answers
15views

Problem with JS/TailwindCSS initializing/compiling

I am developing a food recipe app but got stuck and have a problem with javascript and css(Tailwind) assets. Both Javascript and new tailwinf codes not compiling at all. It was fine before but when i ...
user avatar
0votes
1answer
17views

How to combine 2 array

I have 2 arrays of objects, I want to combine both array of objects as one array, by adding 2nd arrays key value pair as 3rd key value pairs for 1st array. First array a = [{:performed_at=>"...
user avatar
  • 1,052
0votes
1answer
12views

trying to add solidus to gemfile but having issues

this is what im getting when i add solidus to gemfile Bundler could not find compatible versions for gem "actionmailer": In snapshot (Gemfile.lock): actionmailer (= 7.0.2.3) In Gemfile: ...
user avatar
  • 1
0votes
1answer
17views

Cannot destroy a model with a has_many through assocation

I have the following models linked through a has_many :through associaton. Below is the following models class Campaign has_many :email_notification_code_percentages, dependent: :destroy has_many :...
user avatar
  • 4,301
0votes
0answers
29views

the following query is resulting in PG::OutOfMemory error when I run this on 2000+ records at night

I am trying to determine if I just need to upgrade out postgres plan, or if theres is a way to improve this query im running in rails at night on 2000+ records. values = self.users.pluck(:id)....
user avatar
0votes
2answers
30views

Sort an array of hashes by value if such value is not nil (using sort_by)

I am trying to perform a sort_by on a hash, but whenever I have a nil value I get: comparison of DateTime with nil failed My goal is to perform a nil check (.present?) on x[:last_posted_at] inside the ...
user avatar
  • 3
0votes
1answer
12views

RSpec: factory not persisting after attribute changes?

Im fairly new to RSpec but I am running into an issue (This is on Rails 4 fwiw). I have a simple model/factory test: context "Scopes" do let (:widget) {create(:core_widget)} it &...
user avatar
  • 2,099
0votes
0answers
34views

Active Storage _blob partial not being respected or loaded

I am trying to edit app/views/active_storage/blobs/_blob.html.erb, the partial file created when installing active_storage which allows you to customise how blobs appear inside action_text output. On ...
user avatar
  • 7,750
-1votes
0answers
17views

the text I typed appears the same way on the screen

I have written a text like this: **Lorem ipsum pain sit amet, consectetur adipiscing elit. Phasellus in dui ligula. Mauris vehicula risus to ipsum bibendum: quis sollicitudin elit vulputate. Donec ...
user avatar
0votes
0answers
12views

ROR - scatter graph - how to add background image?

Not sure this question is allowed here. I am not looking for an opinion but an answer on how to approach this. I am scratching my head where to find help on technically how to approach this.- not ...
user avatar
0votes
0answers
19views

Slow active record query rails 5.1, selects all messages to get most recent and count

I have a very slow query that ends up scanning all messages in order to show a users most recent. def followed_members(limit = 6) page = helpers.param_helper(:page, 1) ids = ...
user avatar
0votes
0answers
21views

When using activestorage in Rails 6, how do I retain a file when redisplaying a form WITHOUT uploading?

What I'd like to know is very simple: How to retain uploaded files on form resubmission in Rails6 with ActiveStorage? I have checked the below as a similar question. When using activestorage in Rails ...
user avatar
0votes
0answers
11views

failed to build rails server cause of tzinfo

i already add gem 'tzinfo-data' on my gemfile but its keep saying please add tzinfo-data when I make rails server. Is it because of the rails that I install or ruby that I install, or maybe there is ...
user avatar
-1votes
0answers
22views

How to call the delayed job method in rspec

As i have a method in which i need to test , but it was in delayed job, so how to call that method on delayed job in rspec my code structure will look like this def method1 self.delay.method2 end ...
user avatar
  • 41

15 30 50 per page
1
2 3 4 5
6627