How do I transfer content of production databse to my development database

0
Databases
Dear experts, I have a rails application that I was running on production environment. The data upon interacting with application on browser was therefore added to the production database. I would...
Shivam Barthwal posted

How to change de database of Sqlite3 to MongoDB on rails 5?

0
Databases
Hello guys i have a project Rails 5 with database sqlite3 and a lot scaffolds, but now i need change the databse for MongoDB, but the MongoDB dont use the active record. How i change this or remove...
Thomaz Wanderbruck Schmidt posted

PG::InsufficientPrivilege: ERROR: permission denied to create extension "pgcrypto" HINT: Must be superuser to create this extension. : CREATE EXTENSION IF NOT EXISTS "pgcrypto"

1
Databases
Hi everyone, I have been deploying following the guides of this site. However, I had introduced the use of UUID and so I have set the use of extensions for PostgreSQL. Now, when I deploy, I get the...
Julio Cesar Fausto replied
Solved

Default Order of Associated Model Collection?

5
Databases
Hey all, I'm working on a side project where I recently switched from SQLite to Postgres in preparation for deployment. So, I replaced the `gem sqlite3` with `gem pg` in my Gemfile, ran`bundle i...
Chris Oliver replied
Solved

Polymorphic Search

0
Databases
I have a basic model structure like this: ``` class History < ActiveRecord::Base belongs_to :historical, polymorphic: true, touch: true end ``` with several related models: `has_many :histo...
Dan Tappin posted

How do I structure a Bookings table for two models?

0
Databases
I've primarly built out support to book a flight, and now I'm looking to offer the ability to book a hotel as well. I'm looking for some insight on the best way to model this: Currently there is a...
Taylor Cooney posted

find_by not returning array but class insance

0
Databases
What am I missing please? class Choice < ApplicationRecord belongs_to :choiceable, polymorphic: true belongs_to :room_item, optional: false end create_table "choices", force: :cascade do...
jason Mardell posted

How can I improve query time in SQL ? (PostgreSQL)

1
Databases
Hi, I have 4 models: ``` class Match < ApplicationRecord belongs_to :tournament scope :next, -> { where('date > ?', Time.zone.now) } end ``` ``` class Tournament < ApplicationRec...
Boris Bresciani replied
Solved

TinyTds::Error (closed connection): when using Apache/Passenger

4
Databases
When I start my application using Puma on port 3000 everything works as expected (no error). When I try to access the application after starting Apache, using the default port 80, I get the error "...
William Jones replied
Solved

Gem for Master-slave Replication

0
Databases
Hi, I'm trying to make master-slave replication(One master(write/read) and one slave(read only)) for my database(mysql 8 / rails 4.2). I researched whole day but I'm still considering which gem is ...
Sean posted

How to do a incremental backup

1
Databases
Hey, taking a full backup every day will be huge, so thinking of doing a full backup once in a month & incremental backups every day or so. I would like to know the best solution to achieve this.
Nithil replied
Solved

How do I improve these relationships (Rails Association question) ?

1
Databases
Im trying to make a project to practice more kinds of associations would you kindly help me understand this? The basic idea is to have a betting game where one user generates a new bet that can on...
Nicholas Bayley replied
Solved

Design a store credit schema

0
Databases
Hi, I was wondering if anyone has some experience building a store credit system into a market place style app. Eg: Users could purchase 100USD in adavance and receive 120USD in store credits as in...
gafemoyano posted

NameError (undefined local variable or method `fetch_records' for ....

3
Databases
Hi, I'm getting this wierd error. ``` NameError (undefined local variable or method `fetch_records' for #): app/controllers/admin_controller.rb:69:in `block (2 levels) in comments' app/controller...
Victor Nizeyimana replied
Solved

How do I switch from 1 database to 1 database per client?

6
Databases
I have a multi-tenancy app where everything is stored in 1 Postgres database. All models have a account_id, so the data a customer can see is based on his account_id. This works perfect, but due to...
Ary Rabelo replied
Solved

How do I convert a SQL query to rails?

0
Databases
Hi, I'm new to ROR. The query I created below is functioning properly. I'm trying to prepare an interrogation. But I didn't succeed. The query is as follows; @rad_check.tenant_id = SELECT groupn...
Emrah Yıldırım posted

Loosing my attached_images when cap deploy after switching my path so that my posts stay

1
Databases
Okay one last question :) To avoid that cap production deploy is killing my Posts from the database i added production: adapter: sqlite3 database: /home/deploy/apps/Blogapp/releases/shared/d...
Sebastian replied

How do I write the correct association?

0
Databases
If I wanted to have a "user_type" column in my "users" table that references to another table called "user_type", how do I write the correct association in rails? For example if my user_type is 1 a...
Arzee posted

What database should I use?

1
Databases
I would like to create a database to store how often access tokens in my system are being used.I was thinking of a data model like so -Access Tokenfrom (basically I will store this hourly, so this ...
saravanagumar replied

How to structure DB in such a way that we can create attributes dynamically in rails

0
Databases
Hi I am trying to create for example a contact model but currently i only know of for example first name, last name and email but would want to give the user a choice of entering more custom f...
Anand Duddella posted

Want to stay up-to-date with Ruby on Rails?

Join 89,509+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.