Open source RDBMS (relational database management system) when used in conjunction with the Ruby on Rails framework.
0
votes
1answer
32 views
Postgresql: How to perform cross db queries
I currently have 2 same schema databases (1 for staging and 1 for production). One issue I had was by accident the staging was used with real production data, I simply can't manually input it on the ...
-4
votes
0answers
13 views
How to create relation in NoSQL with tables: province, district, ward [closed]
I have a database SQL: province, district, ward, and the relationship. How to switch to NoSQL? very grateful.
>
== Province == == District === == Ward ==
- id ...
0
votes
1answer
13 views
Find records where a timestamp is present
I'm migrating from SQLite to PostgreSQL, and the following query is not working anymore:
where("my_timestamp is NOT NULL and my_timestamp != ''")
How can I find all records that have a certain ...
1
vote
2answers
13 views
Setting up a PostgreSQL db for Ruby on Rails locally
I'm stumbling on the real basics because I cannot find any clear directions.
I have installed Postgres.app 9.3.5 on OS X.
The documentation tells me how to create a database, createdb mydb, but to ...
0
votes
0answers
10 views
Postgresql precision and scale dont work
I have a problem with precision and scale on decimal column.
Firstly i have a column c.float :price, but i fixed this with migration
change_column(:products, :price, :decimal, :precision => 8, ...
0
votes
2answers
44 views
How can I combine two Rails 4 where queries that query either side of a boolean condition?
Question:
Is there a way to combine the following two queries (including the assignments) into one query? I'm not sure how much time I'd really save. In other words, I'm not sure if it is worth it, ...
0
votes
1answer
56 views
How to compare if a record exist with json data type field?
I want to check if a record already exist on database, but I have one json data type field and I need to compare it too.
When I try check using exists? I got the following error:
SELECT 1 AS one ...
0
votes
0answers
45 views
Rails 4 - Desire To Set PostgreSQL Password & Access Database in Rails
I added the following question in April 2014 hoping to set up a password for PostgreSQL but never found a workable solution. I am using a Mac Mini Server running the latest version of Mavericks with ...
0
votes
1answer
19 views
comparison of [type] with [other_type] failed on Rails 4, postgresql with hstore
When doing an upgrade from Rails 3, postgresql with activerecord-postgres-hstore gem to Rails 4, postgresql and native Rails 4 hstore, I started getting masses of issues with tests failing (which ...
0
votes
2answers
84 views
Creating a PostgreSQL sequence to a field (which is not the ID of the record)
I am working on a Ruby on Rails app. We are using a PostgreSQL database.
There is a table named scores with the following columns:
Column | Type
--------------+-----------------------
id ...
0
votes
3answers
37 views
Rails 3.2 ActiveRecord selecting results from two similar tables
This feels like something that should already have been answered, but my search foo is failing me.
Working in Rails 3.2, suppose we have two DB tables that have sufficiently identical columns for the ...
0
votes
1answer
103 views
Error Installing PG Gem on Windows
I'm using XAMPP as my installation folder for PostgreSQL 9.3.
C:\xampp\pgsql\9.3
And now I'm trying to install PostgreSQL gem using that directory as a reference:
gem install pg -- ...
0
votes
0answers
40 views
Custom options for a custom database column in Rails
I'm creating a custom extension for the PostgreSQL database adapter to add geometry as a data type. I've been able to successfully add geometry as a column type but the options don't seem to stick.
...
0
votes
1answer
70 views
How to set default 'uuid-ossp' extension to all migration files using rails?
How to set default 'uuid-ossp' extension to all migration files?
enable_extension 'uuid-ossp'
I'm using ruby 2.1 and rails 4
PostgreSQL
Thanks,
-1
votes
1answer
120 views
Ruby on Rails: must appear in the GROUP BY clause or be used in an aggregate function [duplicate]
This is my query.
ShopifyOrderLineItem.select("shopify_order_line_items.*, sum(amount) as total_price, sum(quantity) as total_quantity").where(:vendor_id => ...
1
vote
1answer
468 views
Postgres operators for JSON data type using Rails 4
Got a record:
2.1.1 :202 > r.column_data
=> {"data1"=>[1, 2, 3], "data2"=>"data2-3", "array"=>[{"hello"=>1}, {"hi"=>2}], "nest"=>{"nest1"=>"yes"}}
Trying to query inside ...
1
vote
1answer
50 views
Using UPCASE or Regexp in Array Column on Postgres
I am trying to query a Postgres Array Column disregarding case and perhaps even disregarding spaces as well.
SELECT "cats".* FROM "cats" WHERE ('CATS - PERSA' = ANY(UPCASE(cat_types))) ORDER BY ...
0
votes
1answer
46 views
Postgres server doesn't launch
I try to set up Postgres for rails in order to be able to deploy on Heroku. I am actually resuming rails tutorials and am a bit lost (am no programmer)
In PgadminIII I try to connect to the single ...
6
votes
3answers
2k views
Postgres JSON data type Rails query
I am using Postgres' json data type but want to do a query/ordering with data that is nested within the json.
I want to order or query with .where on the json data type. For example, I want to query ...
0
votes
2answers
80 views
Getting database ID of scaffold object in rails
I have a scaffold form Student with some fields like first_name, last_name, DOB, GPA, etc. and I want to be able to reference their database ID once they've been created and wondering what the best ...
0
votes
0answers
61 views
Generate barcodes in PostgreSQL
I'd Like to ask if there are any lib to generate bar codes in PostrgeSQL, maybe in Java or pl/Ruby?
I have to insert such barcode inside HTML template generated in the server-side.
Thanks in advance.
...
1
vote
0answers
59 views
PostGIS performance issue with grabbing points by bounding box
I'm working on a google maps application along with Postgresql and PostGIS that fetches markers based on the current viewport of the map and the zoom level (each marker has a min and max zoom level ...
0
votes
1answer
215 views
rake db:seed not working in dev - pg is running but the connection is being refused
I'm trying to follow along on this tutorial and can't get past the setup of pg.
https://shellycloud.com/blog/2013/10/adding-search-and-autocomplete-to-a-rails-app-with-elasticsearch
I set up pg on my ...
0
votes
0answers
711 views
PG::UndefinedTable: ERROR: relation “column_name” does not exist
I have the following error inside Heroku logs after I run pgbackups:restore:
PG::UndefinedTable: ERROR: relation "column_name" does not exist
When I run command pgbackups:restore, it seems that ...
0
votes
3answers
90 views
Is the Ruby on Rails database stored in the same place as the rails code by default?
I am relatively new to Rails and web development. This is a simple conceptual question. Say you are developing the rails code on your local machine and then you push your code to a server. Is your ...
1
vote
2answers
45 views
Why are all of my tables in Rails 4/Postgres being created with “dimension” of 1?
I'm running into a LOT of problems just trying to do basic model generations and migrations in Rails 4 with Postgres. I have the pg gem installed, version 0.17.1.
In the beginning, I couldn't even ...
2
votes
1answer
331 views
How to query tables in Rails console
I have this application which I'm messing around with. (didn't create it, but trying fiddle with it and learn more about querying it, etc).
So, it has a lot of tables.
So, when I go into console, ...
0
votes
1answer
67 views
Efficient database querying Rails
I'm using Rails 4 with PostgreSQL, and I have a table Quotes gets populated at random times. Sometimes two entries are milliseconds apart, sometimes hours (end of trading day). I'd like to build a ...
1
vote
1answer
53 views
SELECT MIN and MAX across fields and aggregate by user
I have the following raw data saved in the db
id min_price, max_price, min_x, max_x, user_id
-------------------------------------------
1 50 200 5 null 1
2 0 ...
0
votes
3answers
90 views
Get a user's posts ordered by most recent comment on post
If I have the following relationship:
User
has_many :posts
Post
has_many :comments
belongs_to :user
Comment
belongs_to :post
How do I get a user's posts ordered by the most recent comment on ...
0
votes
1answer
69 views
ActiveRecord::ArrayTypeMismatch must be an Array or have a valid array value
I have a model with an attribute of type date_array. The database is postgresql. When updating the model with the value of the attribute being an array of correctly formatted date strings, I get this ...
4
votes
2answers
1k views
Avoid PG::InvalidTextRepresentation error when using Postgres UUID in Rails
I started using Postgres UUID type for all my models' id fields. Works great and is supported (for the most part) in Rails 4:
create_table :users, id: :uuid do |t|
# ...
end
The problem is that ...
1
vote
1answer
40 views
Migrating sqlite3 to postgres in rails app
I have read several posts and watched the railscast on migrating from sqlite3 to pg and all of them seem to have conflicting settings and I have not seen anyone run into the error I'm getting. I have ...
0
votes
1answer
189 views
Case expression does not return the “else” value in Postgres query
I'm creating a SQL query with a lot of nested queries and I'm trying to use the CASE expression but it is behaving weirdly.
This is my query at the moment:
select t.fpl_id, t.team_name,
...
1
vote
0answers
94 views
Rails: Update a column with the value of a column in another table
I have basically the following code:
ModelA.join(:modelB).update_all('modelA.column = modelB.column')
That fails with:
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: missing ...
0
votes
1answer
40 views
RoR Activerecord: joining query with two associations that share a model
I have a model called flightleg:
class FlightLeg < ActiveRecord::Base
....
belongs_to :departure_airport, :class_name => "Airport"
belongs_to :arrival_airport, :class_name ...
0
votes
1answer
43 views
Compare only the times of two timestamps in postgres
In PostgreSQL, I need a way to determine if the current time is within the hours of operation of a certain model with an opens_at and closes_at timestamp. What would be a valid Postgres way of doing ...
0
votes
0answers
57 views
Radio button selection Rails - Across partials
I am trying to allow the user to pick one of the predictions out of the 7/8 (which are loaded with the predictions partial) as a double match (double points for anyone interested). I can't get it to ...
1
vote
1answer
84 views
Too many database connections created in rails 2.3.18 application
We have many models like the below one.
class User < ActiveRecord::Base
create_connection
def create_connection
# we have used this ...
1
vote
2answers
148 views
rails - does postgres or rails automatically validate that a datetime column can only have datetime object?
I have a rails 4 form in which a user inputs a string that represents a datetime:
<%= f.text_field :time_frame, class: "calender_pop" %><br />
No where in my code am I converting the ...
1
vote
0answers
79 views
Populating rails Database from Amazon RDS data
I currently am working on an inventory application(rails 4.0 on Heroku using PostgreSQL). I also have a database that tracks my sales on Amazon RDS using Sql Server 2008. I'd like to figure out a way ...
1
vote
2answers
2k views
PG::UndefinedTable: ERROR: relation «productsrules» does not exist
I'm having this issue with one of my PG DB table. I have a table, whose name is "hproducts_rules". This is supposed to have a "belongs_to" relation with the "hproducts_matchs" table.
This is my ...
2
votes
0answers
114 views
hstore on Heroku: can't iterate over hash members
I have an hstore attribute called properties. The following code puts a line break between each attribute before outputting it to the view.
def item_properties_to_string(item)
return nil unless ...
0
votes
0answers
166 views
Rails 4 polymorphic, self-join or ancestry?
I've got a Venue structure to create where you are able to place different types of components under different locations in the same Venue so the structures are like this:
Main Hall -> Conference ...
2
votes
2answers
114 views
Importing CSV into Postgresql with duplicate values that are not duplicate rows
I am using Rails 4 and postgresql database and I have a question about entering in a CSV dataset into the database.
Date Advertiser Name Impressions Clicks CPM CPA CPC CTR
10/21/13 ...
0
votes
0answers
197 views
postgresql gem with ruby 2.0.0-p353 on mac wont suceed
I'm trying to bundle a new rails app using Postgres.
I get this error each time I try to bundle.
Errno::EACCES: Permission denied - /usr/local/var/rbenv/versions/2.0.0- ...
0
votes
0answers
103 views
Rails select NoMethodError in Messages#new
I'm trying to put on a select box the Users who will receive the message.
What we have is one table named Messages, one named Users and one named Friendships, on message table we have user_id (sender) ...
1
vote
1answer
231 views
Rails - Issue when running bundle install - Installing pg (0.17.0)
When running 'bundle install' I get the following error message.
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
...
1
vote
1answer
730 views
Bulk create records in rails?
Ok so I have a rails application called HashtagMapper.com which finds tweets by the thousands and maps them. The problem I am having is that between geocoding 1000+ queries can take up to 10 seconds, ...
3
votes
2answers
2k views
Rails 4.0.1 on Heroku, can't create database
I can't get rake db:migrate to run on my rails 4.0.1 app on Heroku.
I'm guessing that I don't have postgres configured properly... but reading the docs on heroku hasn't really helped and I'm not sure ...