Skip to main content

All Questions

Tagged with
1 vote
0 answers
305 views

Cant install Mysql2 Gem::Ext::BuildError: ERROR: Failed to build gem native extension

Im using ruby '2.7.5' and rails '6.0.4.7' on WSL2 I'm trying to install the mysql2 gem but I keep getting the following error: Gem::Ext::BuildError: ERROR: Failed to build gem native extension. ...
JulioCarvalho's user avatar
0 votes
0 answers
77 views

Mysql2::Error: All parts of a PRIMARY KEY must be NOT NULL

I am using a legacy version of rails 3.2.22 and while trying to execute my migration file, I encountered this error: rake db:migrate == CreateBooks: migrating =========================================...
Wargame Elliot's user avatar
0 votes
1 answer
77 views

Better way to do this rails / SQL query?

I have a Rails SQL Query where I want tasks of a priority 2 AND has a substring of a larger string, ALL tasks with priority 1, and ALL tasks with priority 3 what would be a better / more efficient ...
jtb-apps's user avatar
0 votes
2 answers
554 views

I got the following error while running gem install mysql2 on windows 10

I downloaded and installed ruby from this https://rubyinstaller.org/downloads/ -> Ruby+Devkit 2.7.3-1 (x64) and follow the installation steps. but I got a error when I tried to install mysql2 for ...
taha mousavi's user avatar
0 votes
1 answer
890 views

How to update related attributes while saving objects in Rails Active Record

My current logic is, taking two inputs from form where one is primary book and one is secondary book and save it to database with is_primary check being true for primary book and false for secondary. ...
Ajit's user avatar
  • 336
1 vote
0 answers
121 views

Uppercase column names from MYSQL

Have an external MYSQL DB and I am connecting it to the ruby app. All the columns are changes to uppercase and when I try to query something it works but ruby gives an undefined method error when i ...
Nick Bb's user avatar
  • 601
0 votes
1 answer
52 views

Rails 3: Given a player, find the number of times they have been paired with each opponent

I am using Rails 3.2. My schema is quite more complex but simplifying, I have Pcs (representing players), Games and Projects such that: class Game < ActiveRecord::Base has_many :projects class ...
raquelhortab's user avatar
0 votes
1 answer
253 views

Rails: find all resources not already connected through join table

I am trying to rewrite actions which connect and disconnect products to and from projects. Currently my select_to_project view shows all products, but I would like it to display only products which ...
SEJU's user avatar
  • 1,145
0 votes
1 answer
30 views

Active record lookup - find_by_inventory_product_id is intermittently slow inspite of adding index

I have a simple new API endpoint, which involves querying my newly setup and populated table - inventory_products. The schema of inventory_products table is : CREATE TABLE `inventory_products` ( `...
user3903418's user avatar
0 votes
1 answer
101 views

How to prevent the carriage return character that appends in a html form textarea?

I just encountered a bug in my rails3 application while setting up WhatsApp messaging service via a third party API. I have my message template set at the 3rd party portal. Now when my client is ...
Anumit Kaur's user avatar
0 votes
2 answers
956 views

How to get column name for primary_key at database level?

I need to get the column name containing the primary key(s) at the database level. Model.primary_key returns models_id column name which is not the primary key at the database level. I cannot change ...
Pants's user avatar
  • 2,792
0 votes
0 answers
51 views

I have created a table in rails using the migration file. But I am not able to access the table in the rails console

I have created a table called as Flowlogs in the rails application using the migration file. I've also fed the data to that table in the rails console. All of a sudden when I try to manually feed the ...
Abhishek's user avatar
  • 107
3 votes
1 answer
2k views

Rails: query for 2-step relation through join-table + has many relation

I am working on improving my database scheme. Currently I use a has_many through structure with a land model/table a shippingservice model/table and a postzone model/table, which connects land and ...
SEJU's user avatar
  • 1,145
0 votes
1 answer
49 views

Complex active records query for AJAX resource

I have one select field for countries, a second select field for shipping options for a given country and when 1st country and 2nd shipping has been selected I would like to display the shipping cost. ...
SEJU's user avatar
  • 1,145
0 votes
1 answer
230 views

Rails: active-records query for entry in range & included in

I am working on a shipping implementation for a checkout process. My app has carts, cart_items, orders and order_items. Weight and size of all items are in the database and I calculate ...
SEJU's user avatar
  • 1,145

15 30 50 per page
1
2 3 4 5
65