I created a Rake test: namespace :dev do DEFAULT_PASSWORD = 123456 desc "Sets up dev environment!" task setup: :environment do if Rails.env.development? show_spinner("Deleting database...") { %x(rails db:drop) } ...
databaseanswers.net Latest Questions
I have experienced this a few times trying to install different gems using 32 bit ruby, this time I upgraded to Ruby 3.1.2 in hopes it would be resolved Specifically it appears that either gem maintainers, or the maintainer of MSYS/MINGW ...
I will go stright to the point: I have these two models: User Followed The Followed model has user_id (the user that follows another user) and followed_id, the user that is followed by the user with user_id. the User model looks like this: has_many :followeds, foreign_key: ...
I’m trying to connect a rails app to a remote Postgres database (using the PG gem) and getting issues. I set my database.yaml file development: adapter: postgresql encoding: unicode database: testdb username: testuser password: "*******" host: ...
In rails 4, I want to get the last row of data inside scope. I have models called Abc, AbcRoot, AbcRootDisabling and inside Abc model, def self.including_abc_disablings joins('JOIN abc_roots_abcs as crc ' \ ...
I stumbled upon following issue. I’ve upgraded my postgres to version @13 by running brew install postgresql@13 – this installed version 13.8. I then added paths to my ~/.zshrc (for compilers too). Then I run source ~/.zshrc, even restarted the whole ...
The models in question are: User Followed The "followeds" schema(or table) has "user_id" that is a reference to "users" table And it has "followed_id" that is an integer. What I want to achieve: Inside my controller I want to select all ...
I’m trying create a app with ruby on rails in termux, I already installed the necessary gems and packages for the setup, but when doing rails db:create. I get this error rails aborted! ActiveRecord::ConnectionNotEstablished: connection to server on socket "/data/data/com.termux/files/usr/tmp/.s.PGSQL.5432" failed: ...
I was trying to rake db:migrate:reset on the AWS Cloud9 environment. However, the error below came up. I searched for this error and looked through multiple articles, but I had no idea to fix. I would truly appreciate it if ...
I have a model ServiceAgreement with :starts_at(Datetime), :ends_at(Datetime), and :service_interval(integer that corresponds to an enum) {"weekly"=>0, "every_month"=>1, "biannually"=>2, "annually"=>3} I need this virtual column to be an array of the proposed service dates based on the distance between starts_at and ends_at. ex. ...