Open source RDBMS (relational database management system) when used in conjunction with the Ruby on Rails framework.

learn more… | top users | synonyms

3
votes
0answers
189 views

Disable automatic cast of cidr columns in rails 4

When using rails4 and having columns in a postgresql database of type cidr, rails now casts them to type IPAddr. In rails 3 they we simple strings. How can I disable this casting so that I get the ...
3
votes
0answers
924 views

Heroku Postgres Out of Memory error

My Rails app has been running fine until this morning. I tried restarting the app and here is the error i'm getting before i even hit a page. Out of Memory error on the Postgres connection! I can ...
2
votes
0answers
198 views

Flickering Tests with PhantomJS and Rspec

I am using PhantomJS in my Rails app for integration testing of a form that is submitted through AJAX. My test suite runs green the first few times, and then eventually I run into these errors, which ...
2
votes
0answers
102 views

Matching special characters (e.g. #, +) using pg_search

I'm using the pg_search gem in a Rails app to search against users - their bios and associated skill model. Users are developers, so their skills include things like "CSS", "C++", "C#", "Objective C", ...
2
votes
0answers
439 views

Find values greater than using hstore and rails

I am storing product information, including the release year of the product, using hstore and postgresql in rails. Now I would like to be able to query for all products that was released before or ...
2
votes
0answers
147 views

Rails background worker seems to be wrapped in a transaction

I know how useless and vague the title is. Sorry. I don't have much other than some observation and evidence that nothing changed in my code. I have a Rails 3.2.14 app using DelayedJob and PostgreSQL ...
2
votes
0answers
135 views

Foreign key associations in Rails with Postgres array possible?

Given the following Tweet: # db/schema.rb create_table "tweets", force: true do |t| t.integer "project_id", null: false t.integer "author_id", null: false t.integer ...
2
votes
0answers
65 views

Data not saved with attr_encryptor

I would like to encrypt data in my project so I use https://github.com/danpal/attr_encryptor I use this gem like this for my User model for example : attr_accessible :name, :mail attr_accessor :name ...
2
votes
0answers
523 views

Rails Postgresql Time Column

I've got 2 Time Without Time Zone columns in my table (start_time and end_time). When an event occurs, I need to see which of these columns has a start_time < Time.now < end_time. The problem ...
2
votes
0answers
337 views

Heroku + Rails 3.2 + PostgreSQL = NoMethodError: undefined method `result' for #<NoMethodError:..>

NoMethodError: undefined method `result' for #< NoMethodError: ...> Stack trace refers to this place: def current_income return @current_income if defined? @current_income if ...
2
votes
0answers
247 views

Why does Rails change the time returned from a Postgres function to UTC?

Can anyone explain this? It is as if Rails is overriding Postgres and telling it to work in UTC when I want it to work in my local timezonw? I have a Postgres function which returns the local time as ...
2
votes
0answers
201 views

Rake migrate Error - database doesn't exist

I have a padrino project that uses data mapper and postgres. When I run padrino rake dm:create it says that the database is created. However, when I run padrino rake dm:auto:migrate, I get the error - ...
2
votes
0answers
384 views

Reconnect after a PG::Error SSL SYSCALL error in Rails on Heroku

I've recently experienced H12 request timeouts on Heroku caused by PG::Error SSL SYSCALL error: EOF detected. Relevant portions of the stack trace include: 2013-04-05T22:07:02+00:00 heroku[router]: ...
2
votes
0answers
151 views

How to find a set of missing dates in a table from date range query

There are some stackoverflow posts related to my question but not all that similar. I would like an efficient and somewhat elegant(if possible) solution as to get an array of missing dates after ...
2
votes
0answers
621 views

rails 3 dumping PostgreSQL database into schema.rb ignores primary keys

rake db:schema:dump Changes: create_table "accounts", :force => true do |t| ...some columns... end Into: create_table "accounts", :id => false, :force => true do |t| t.integer ...
1
vote
0answers
19 views

server doesn't listen postgresql 9.1 after service change

I did Install PostgreSQL 9.1 on my 2012 R2 windows server It did installed successfully now I changed PostgreSQL service account Facing error when trying to restart PostgreSQL service ! The ...
1
vote
0answers
48 views

Rails Postgres HSTORE: PG::InternalError: ERROR: Syntax error near '=' at position 1

I'm trying to execute a where() with false, but instead is executing it as if I passed a query: PG::InternalError: ERROR: Syntax error near '=' at position 1 LINE 1: ..."subject_users"."subject_id" ...
1
vote
0answers
104 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 ...
1
vote
0answers
991 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 ...
1
vote
0answers
121 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 ...
1
vote
0answers
86 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
0answers
137 views

postgres error role and db doesnt exist after downloading OSX Mavericks

I restarted my computer recently and after trying to start my db locally with rails s I got the following: ...
1
vote
0answers
182 views

failing migrations : PG::ProtocolViolation Rails

I just updated to rails4 and realized that my db roles and database was somehow not setup. So I dropped the db and re-created the app_development db and the roles. Now I am trying to run rake ...
1
vote
0answers
60 views

PG::Error - Refinery CMS - Blog Post Create Error

I'm getting an error whenever I try to create a new blog post. I am running refinery 2.1 with the blog gem installed. I have recently upgraded from 2.0 and have migrated and seeded the database. I am ...
1
vote
0answers
241 views

How can I order by a specific condition in Active Record?

To list all the shops in my database, I have the query @shops = Shop.includes(:opening_times) .references(:opening_times) .limit(paging) .offset(@offset) If I ...
1
vote
0answers
70 views

Why does explicitly passing a hash allow heroku postgres to set primary keys as I want it to

Spent the past hour running migrate on heroku wondering why the following migrate doesn't set the primary key from id to what I want it to be: class CreateProducts < ActiveRecord::Migration def ...
1
vote
0answers
44 views

How do I add some columns to a generated SELECT statement in Rails?

I'm a beginner. My model: class Publisher < ActiveRecord::Base has_many :articles has_many :transactions, through: :articles has_many :reader_profiles, -> { uniq }, through: ...
1
vote
0answers
114 views

Rails app: errors moving from postgres to mysql on ubuntu ec2

So after some problems with postgres on rails ala this Postgres rails doesn't recognize user, I uninstalled postgres and decided to try mysql for my rails app. I installed mysql successfully, and ...
1
vote
0answers
98 views

Postgres rails doesn't recognize user

So my rails app gives me the "We're sorry, but something went wrong." When I check the logs, I see PG::Error (FATAL: role "ubuntu" does not exist ): However, when I then do this (note I believe ...
1
vote
0answers
660 views

ActiveRecord::ConnectionNotEstablished with postgres

I'm getting the below exception while migrating data from JIRA to Redmine using the script provided on the official redmine website (the Luciano Pacheco, 2011-06-07 06:28 version): -bash-4.1$ rake ...
1
vote
0answers
245 views

first_or_create not saving one column or attribute postgresql

folks. When issuing the following code block in the controller, the resulting SQL does not include one column/attr of the model: dev_total = DeviceTotal.where(time_stamp: ...
1
vote
0answers
37 views

Batch text search with PostgreSQL

I have a Rails 4 app with PostgreSQL database. I use PSQL default full text search for some fields, such as university_name. I need to send hundreds of full text search query at a time against my ...
1
vote
0answers
533 views

Rails 4 and PG:UnableToSend error (connection pool? Timeout?)

I'm new to rails and its' ecosystem, and I'm deploying a rails 4 app on nginx/passenger, configured to access a remote postgres db. When a user first accesses the app, it encounters an error, but ...
1
vote
0answers
316 views

how to speed up: ActiveRecord hstore assignment

I have a rails app, using ActiveRecord and Postgresql. have a field in my model called meta_data and am trying to speed up a data import routine I've built. the model is defined as such: (I cleaned ...
1
vote
0answers
112 views

Active Record: Add metadata to attributes

I got the following problem: I have a rails4 application with a postgresql. The database contains data that is imported from different sources. These sources have different priorities (or ...
1
vote
0answers
170 views

Rails/Postgres auto-increment column based on foreign key

In a Rails app I'm building, I need what I can best describe as a contextual auto-incrementing column. Essentially, the Bar model belongs to Foo via a foo_id column. I need to increment contextual_id ...
1
vote
0answers
264 views

Rails PG::Error: ERROR: value “214524245325432453” is out of range for type integer

This error is is triggered by PG before any validations like "greater_than". How can I handle this the Rails way and not in the controller?
1
vote
0answers
204 views

data load scripts in Ruby - Make ETL in ruby scripts more dynamic

I have written a bunch of data loading commandline ruby scripts. Most of the scripts extract data from one database table and load the data to another database. For the most part, there is a ...
1
vote
0answers
87 views

Validation creating error during postgresql migration

I'm migrating an app from rails 2.3 to rails 3. I'm planning on moving to heroku, so I'm also moving to postgres. I have a model which has lots of fields - about 30. I want to validate the ...
1
vote
0answers
204 views

Redmine on heroku rake error

I am trying to deploy redmine on heroku. While trying to rake db:migrate I get following error: [desktop:~/redmine-2.3]$heroku run rake db:migrate Running `rake db:migrate` ...
1
vote
0answers
50 views

How to approach developing non-trivial database code in a Rails app

I'm curious to see if anyone has developed a Rails application that includes some [potentially non-trivial] plpgsql or pl/v8 or similar code in the database layer, and if they can provide any ...
1
vote
0answers
126 views

Rails 4, Ruby 2.0: Get PG Error when trying to get all records having a specified value in joined table

Given the following two classes: class VacationRequestDay < ActiveRecord::Base belongs_to :vacation_request, :inverse_of => :vacation_request_days, ...
1
vote
0answers
48 views

Rails 3 Saving User Searches DataModel

I am working on a piece of my app where the client is wanting the ability for user searches to be saved (these searches are completed by the user completing a set of dropdowns and then entering in a ...
1
vote
0answers
85 views

Deploying app to Heroku - dm-core and dm-postgres-adapter issue?

I am having an issue deploying to Heroku - here is the strange line of my log file: /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.0/lib/dm-core/adapters.rb:163:in 'require': no such file to load -- ...
1
vote
0answers
74 views

Rails item feed of distinct items shared by users followed by the current user

So I'm trying to make a feed of items in which the items are distinct, and each item can be shared by many users. My data model is: User: has_many :postings, has_many :products, :through => ...
1
vote
0answers
353 views

Ruby on Rails: Postgres Relation 'lists' does not exist

I'm getting a weird error. I had sqlite3 working and now switching over to postgres, i'm getting this error. I have migrations, and I had to add a new column. create_ideas migration class ...
1
vote
0answers
314 views

heroku pg:transfer - receiving error during upload of postgresql db

I am trying to upload my local database to production and I keep running into the following error while processing: $ heroku pg:transfer --from postgres://username:password@localhost/blog_develo ...
1
vote
0answers
117 views

Postgres periodically slows down on heroku RoR application

I faced with periodic RoR 3 application unavailability. Usually I have 15 minutes unavailability period each day. The problem doesn't relates with application load and I can't find any errors in logs. ...
1
vote
0answers
171 views

ransack search customization using PostgreSQL function

I have an Order model and a Payments model. Order has many Payments. I'm performing a search on the order model using ransack. I have the following association fields for payments in the search ...
1
vote
0answers
189 views

Unable to retreive excerpt from Postgres using pg_search gem

Update First of all, there is no method "context". That was a word my brain made up at some point and stuck with. Obviosuly I should've been running .excerpt(). Second, I was running the command ...