5
votes
2answers
154 views

Rails migration is always inserting whitespaces or changing the ordering of columns in the schema

There is a frustrating issue where my rails migrations update the schema with whitespaces and the position of the table's columns. So most times when I run bundle exec rake db:migrate it will do one ...
5
votes
1answer
250 views

Building and storing complex SQL query for later editing

I am using Rails 3.2.8 to build a "product set" builder that mirrors Google Analytics' Custom Profile builder. For example, a user may define a product set as follows: (Category = 'Printers') and ...
4
votes
1answer
91 views

Rails postgis adapter makes lot of queries in table “geometry_columns”

I'd like to optimize my Rails 3.2.13 application that's currently using postgis through activerecord-postgis-adapter gem. The problem is that when I make a query in a table, even if there are only ...
1
vote
1answer
195 views

Rails3: Validate text max length before storing in DB

I'm currently using 'store' in my Rails model to persist various things in a hash. This is convenient as I don't have to create lots of individual attributes for this data, it serializes/de-serializes ...
0
votes
1answer
51 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,
0
votes
1answer
690 views

Retrieve the nextval from a sequence using activerecord in Ruby on Rails 3.2.14 / Ruby 2.0.0 / PostgreSQL 9.2.4

This should be SO simple. I want to retrieve the nextval of a sequence... it's not a default value... it's not a primary key... it's not a foreign key. In rare cases, I need a sequence number for a ...
0
votes
1answer
502 views

Rails active record query for search filters

Looking at the railscasts.com, I am wondering how Ryan implemented the search filters for the site. If the search param does not match anything in the database, then he is returning ALL records (for ...
0
votes
1answer
1k views

Conflict with Server Version of PostgreSQL 9.2.1 and pg_dump Version 9.1.4 (Rails 3.2.9)

I recently did a clean install of Lion Server on my Mac Mini Server then immediately upgraded to Mountain Lion without copying any of my data from my backup files. Then I reinstalled my Rails ...
2
votes
0answers
744 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 ...
0
votes
0answers
26 views

rails3 PG column error on remote server

I am hitting an error with postgre that rears its head on the production server (development mode), NOT locally. PG::Error: ERROR: column "cart_id" does not exist LINE 1: SELECT "bozzas".* FROM ...
0
votes
0answers
52 views

“Internal error” thrown by Rails to SQL conversion for query

Rails is throwing in "INTERNAL ERROR" when I try to run a particular query, does anyone have an idea how to resolve this? XYZ and ALongString are obfuscations since this is related to my work. ...
0
votes
0answers
62 views

How to sort objects by sum of values from other table

I've got Rails application with PostgreSQL database. There are Shop and Auction classes. Shop has many Auctions and Auction belongs to Shop. Auction has field 'views'. I want to order shops by sum of ...
0
votes
0answers
26 views

Viewing SCHEMA logs for postgresql in Rails

I'm having a hard time trying to get logging to include postgres schema changes in it. I've isolated the line of code that blocks them, but rather than being a configurable option, it seems to be ...
0
votes
0answers
70 views

Rails select by group with Postgresql?

I have a model named Program, which has 'directory_id'、'id'、'user_id' columns, I want to select all the programs group by directory: @programs = Program.select("programs.directory_id, programs.id, ...