I am using Turbo Frames in my Rails app and have, on every page
Tag: ruby-on-rails
Submit a form to Rails backend with ReactJS
It is my first time working with ReactJS in a Rails solution and the task is an emergency request that doesn’t give me enough time to learn React before taking up the sprint to work on. The Backend is …
How to translate this jsonb SQL query to an Active Record query?
The following data is present in my Color ActiveRecord model: id colored_things 1 [{“thing” : “cup”, “color”: “red”}, {“thing” : “car”, &…
Creating a scope in Ruby on Rails, that returns an instance of an object only if all the associated instances fit a certain condition
I have a table called Carts with a has_many relationship to another table called Subcarts. I want to create a scope that returns all instances of the Cart table where all the associated Subcarts fits …
JavaScript countdown timer counting past zero
This might be a really simple thing to ask but I’ve got a JavaScript countdown timer, but I can’t stop it from counting past 0:00. Instead of stopping at this point, it will continue to -1:59 etc. I’d …
v-model in html.erb template renders function () { [native code] }
I am in the process of adding Vue.js to my Rails 6 app. The project is using turbolinks so “vue-turbolinks” is installed via yarn and my Vue config looks like this: import TurbolinksAdapter …
I am using bootstrap and everything is working except for tooltips
Okay so my javascript is definitely not on point, and I am really stuck with integrating tooltips into my rails application. I have done everything that bootstrap is telling me to do in any possible …
How to count the sum of Invoices by last year using SQL in Rails?
I need to count all amount of invoices for last year. I do it using helper method but, as far as I know, there is better way using only one query to database with SQL function SUM(). My invoices table:…
Can I use ActionCable to refresh the page?
I’ve recently been trying to create a live-scoring system for squash matches. I’ve managed to use ActionCable with Rails 5 to auto-update the score on the page, but I’d like to know if it’s possible …
How to force Rails ActiveRecord to use CamelCase in queries, instead of snake_case
I am trying to create a rails app that will connect to a production SQLServer that is used by 3rd party software, so migrating the database is not an option. I am able to connect to the SQL server without any issues (I used this guide for connecting to existing database, and this one to connect rails to SQL Server),