0
votes
2answers
74 views

Complex Rails Query

I have a model structure as below: User has many Surveys through ResponseSets(user can attend same survey multiple times there by creating ResponseSets for each attempt). ResponseSet has many ...
0
votes
2answers
31 views

ROR + PgAdmin + psql: FATAL: role “user1234” does not exist

In my sample project, I am trying to create postgre database. While running the rake db:create, I am getting some strange message and unable to create the database. ...
2
votes
0answers
16 views

Rails test database getting wrong column type on geographic columns

We have a rails app that uses postgis and activerecord-postgis-adapter for geographic information search. However, it doesn't work right in the test database. In development and production database, ...
1
vote
1answer
42 views

Active Record: Find collection based on sum of two associated tables

I am trying to find the collection of 'underpaid' events in our system. We are running Rails 3.2 using a Postgres database. The data structure is as follows. class Event < ActiveRecord::Base ...
0
votes
1answer
26 views

adapter is postgresql, rails server Can&#39;t connect to MySQL server

Although database.yml is configured as follows, development: adapter: postgresql database: saim_development username: jerdvo launching Thin web server (v1.5.0 codename Knife), apparently runs ...
0
votes
1answer
74 views

merging multiple models in rails 3.2 so that users can log in under multiple subdomains using devise

I'm using devise for authentication and am stumped by the way that my users are associated with the subdomains they can log in under. I've studied the info plataformatec provides here and the great ...
-1
votes
1answer
58 views

Sort group of records based on different columns

I have a four columns in table called recordings such as score, event_id, user_id and I would like to sum the score of recordings based on user id + event id, and then I would like to show the users ...
2
votes
1answer
43 views

Select unique records ordered by date

I have 2 following models: class Schedule < ActiveRecord::Base attr_accessible :description, :deadline_on, :repeat has_many :scheduled_transactions end class ...
0
votes
1answer
29 views

rake db:setup is failing for production because I am referencing a Model for a table that yet to be created in an initialier

I'm trying to deploy my application on EngineYard. Right before assets:precompile it checks for database changes as part of the migration. This is causing a failure for me, because I am pre-loading ...
0
votes
1answer
39 views

Disk Size Of Schema PostgreSQL on Rails

I have multitenant app rails and tried for to get size disk of schema posgresql per account. Initially, I tried it at the views, roughly like this : <% for account in @accounts %> <td> ...
0
votes
1answer
50 views

Is there a PostgreSQL setting that I can use to do case-insensitive queries on column values?

I have been using MySQL for 9 years and now have a new Rails 3.2 application in which I am using PostgreSQL. I am getting bitten by a couple of assumptions that I am bringing to the project. With ...
1
vote
2answers
51 views

Query and sort by model's belongs_to relationship

I have a model Book which has many copies. Copy belongs to Book and also belongs to School, which has many copies. I would like to query for books that associate with a school and sort by number of ...
0
votes
2answers
62 views

Is it possible to create an ambiguous foreign key that gets defined on its row's creation?

I have two database tables, houses and apartments. Each of these has its own view page that I would like users to comment on. Naturally, I also have a posts table. When a post is created it should ...
0
votes
2answers
100 views

Trying to run rails app in Heroku I get PG:ERROR connection refused [closed]

When I go to the default rails landing page there is no problem displaying it, but when I try to display the users I get the following message: Started GET "/users" for 190.21.126.51 at 2013-03-27 ...
1
vote
1answer
45 views

Transferring certain Rails objects from staging to production database on heroku

I have a web app where admins are able to create "Book" objects which are published and accessed via API in a mobile app. We want to allow the admins to create these books in a staging environment and ...
0
votes
1answer
101 views

How to solve error of Ident authentication in Rails?

I have setup Rail application in my local server. And I am using Postgresql database. But it creates error : Error message: FATAL: Ident authentication failed for user "nobody" (PG::Error) ...
0
votes
1answer
42 views

Not able to display multiple data from rails 3.2 backend(postgresql) in views

I am currently doing a project for a Library Management system.I have five tables in the project.All of them are interlinked that is they are referencing each other. The tables which I am working on ...
0
votes
1answer
87 views

PostgresSQL Complex indexing types and ordering

I have been doing some heavy reading the last couple days on indexing and I'm trying to figure out the right way to index a query I have with a lot of constraints. I am using the postgres_ext gem to ...
2
votes
1answer
183 views

Rails 3.2 Devise Omniauth-facebook and koala

I am trying intergrate Koala into a devise omniauth-facebook app. For some reason i cannot post to user's wall. I created a second app which doesn't use devise and all works and i realise that the ...
1
vote
1answer
36 views

how to apply autoincrementation in rails 3.2

I was doing a shopping list project in ruby on rails. While creating the table named products, by mistake I have removed the autoincrement option from id field of my table products. Can any one tell ...
1
vote
1answer
97 views

Why doesn't update_attribute change my timestamp column

I have a model with a timestamp column, queued_at. Why doesn't update_attribute(:queued_at, Time.now) write to the database? This only happens occasionally. This is a frequently updated ...
0
votes
1answer
43 views

How Do I Use Joins for Three Tables in Ruby on Rails?

I am working on a Ruby on Rails application which already has logic for text searching using pg_search and two other fields on a model. The logic creates an 'array' of rows from the search result. I ...
0
votes
1answer
38 views

Merge Subquery results column into a single column then use in ORDER BY

I would like to execute some query like this: SELECT folders.*, (SELECT files.filename FROM files WHERE files.folder_id = folders.id ) as ...
0
votes
2answers
412 views

Need to convert a Boolean from Postgres (== String) to a Ruby Boolean

I'm using Postgres with Rails. There's a query with a subselect which returns a boolean, but Postgres always returns a String like 't' or 'f'. But in the generated JSON I need a real boolean. This is ...
0
votes
3answers
40 views

Not sure if my rails application is configured properly for posrtgres db

My problem: I have setup the dev, test environments of my Rails application to use the postgresql database. Now how do I verify that it is ok? Note: I am beginner on Rails and using databases What ...
0
votes
1answer
248 views

PostgreSQL failure on test database for Rails application

Upon running rake db:test:prepare my test database was dropped, but failed to be rebuilt. After researching the errors, I simply attempted to load the database with rake db:test:load to repopulate ...
0
votes
1answer
251 views

Column does not exist error in PostgreSQL database and Rails 3 app

I am getting the error below when trying to query my PostgreSQL database. I can view the table and all columns in pgAdmin and even perform a select *, so I know the table and column exists. Any help ...
0
votes
3answers
123 views

Rails: complex search on 3 models, return only newest - how to do this?

I'm trying to add an advanced search option to my app in which the user can search for certain links based on attributes from 3 different models. My app is set up so that a User has_many :websites, ...
0
votes
2answers
56 views

ActiveRecord association methods not being added to model

I'm having to build a rails app around a legacy PostgreSQL database that doesn't conform to "the Rails way" in the sense that plurality is not possible -- and I'm not sure if that's what is tripping ...
3
votes
1answer
344 views

Model's datetime field is stored differently on heroku from localhost

Steps: On my localhost server I select the time Jan 18, 2013 10 am - 11 am in my browser located in the Pacific time zone. I then select the exact same time on my production server on heroku. As ...
0
votes
1answer
365 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 ...
0
votes
1answer
255 views

Fullcalendar Rails 3.2 - PG::Error

i'm try fullcalendar for my application with rails 3.2 and using postgresql for dbms. to the point, on model event.rb class Event < ActiveRecord::Base attr_accessible :all_day, :ends_at, ...
1
vote
1answer
433 views

Rails 3.2 update boolean value from checkbox not applying

I have an issue whereas I am trying to update a boolean field in the database with true or false based off of a checkbox. I am using rails 3.2.2, using RVM I tried with 3.2.9 with the same result. ...
1
vote
1answer
532 views

Hstore and Rails

I'm trying to use Hstore in a Rails 3.2.9 project using the latest version of the activerecord-postgres-hstore gem and I am having a bit of trouble using the store_accessor provided by ActiveRecord ...
0
votes
1answer
289 views

Error while running the ruby server says connection not established

I am using rails 3.2.9 and database of postgres.. i have edited database.yml file in the following way and also 'gem pg' was also installed.. when i run bundle command it shows pg gem in that ...
0
votes
1answer
133 views

Rails Postgresql sort by random

I am trying to pull out rows from a postgres database, I can pull them out desc but when I try random I get a Syntax error near random. Error PG::Error: ERROR: syntax error at or near "rand" LINE ...
0
votes
2answers
55 views

Limiting inner associations in Rails 3 (ActiveRecord)

I have one to one association with the following active record model (example): User <-1-1-> employee <-1-1-> contact <-1-1-> permanentAddress contact <-1-1-> ...
0
votes
1answer
398 views

Postgres error on insert - PG::Error: ERROR: invalid byte sequence for encoding “UTF8”: 0xe073

I get the following error when inserting data from mysql into postgres. PG::Error: ERROR: invalid byte sequence for encoding "UTF8": 0xe073 : INSERT INTO "places" ("accent_city", "city", "country", ...
1
vote
2answers
133 views

Rails LIMIT per GROUP

I am trying to get records of each category limited to 5, but I ended up returning only 5 records. How can I translate this sql statement in Rails ActiveRecord? SELECT * FROM "jobs" a WHERE ( ...
0
votes
2answers
57 views

OpenGeoDB: migrate mySQL data to postgreSQL

I would like to use OpenGeoDB for my Ruby on Rails project. Kostiantyn Kahanskyi has written the active_geo_db gem which is a "Rails (ActiveRecord) lib for accessing OpenGeoDb". The problem is that it ...
0
votes
2answers
92 views

Rails: moving development environment from windows(mingw32) to OS X mountain lion

I have a rails 3.2.3 application which I was developing on my windows machine using git_bash as cli and mingw32 as environment (installed this env using railsinstaller)and postgres as db. But there ...
2
votes
1answer
253 views

Rails 3.2 + pg gem : load path issue

I have two rails applications, "old" one and new one, created with $ rails new blog -d postgresql when i try to start the server, it works on "old" application without problems: $ rails s ...
1
vote
1answer
443 views

Duplicate primary key, can't access psql console

Problem creating new records in postgres database. Using Heroku Cedar stack and Rails 3.2. Calling create results in ActiveRecord::RecordNotUnique (PG::Error: ERROR: duplicate key value violates ...
5
votes
1answer
128 views

Security implications of deploying rails app using postgresql in “trust” mode to github and heroku

Heroku "highly recommends using PostgreSQL during development" so that's what I've been doing for the last several months. I'm using rails 3.2.8 and between Daniel Kehoe's excellent Rails Heroku ...
2
votes
1answer
337 views

Way to use postgresql and avoid testunit by default in rails 3.2?

I'm tired of typing $ rails new [app name] -d postgresql --skip-test-unit every time I start a new rails app. I'm using rails 3.2. Is there any way to make using postresql and skipping test unit ...
0
votes
2answers
292 views

Why date time different 1 hour when retrieve timestamp data of postgresql from rails

I have a problem that is I migrate database table from rails. In the tables columns timestamps with timezone is also include. When I insert data into database, timestamp columns save current time as ...
0
votes
1answer
81 views

Migrating databases on Heroku fails

In my application one of my models uses a HStore but when I create the extension HStore it fails with the following error: PG::Error: ERROR: syntax error at or near "EXTENSION" LINE 1: CREATE ...
1
vote
1answer
119 views

Heroku and Gemfile management

I am having issues getting an app live on heroku. the error message I am receiving is: "Installing pg (0.14.0) with native extensions ...
3
votes
2answers
606 views

Model scopes are breaking rake db:migrate - rails 3.2.3 postgres 9.1.3

I've come across a problem with running my migrations in a new rails app (3.2.3). We're using postrgres 9.1.3 and - pg (0.13.2) - When I run rake db:create, then rake db:migrate, I get -> ...
1
vote
2answers
602 views

Trying To Set Up Rails To Store Sessions In A Postgresql Database

I have an existing Rails 3.2 app, and I would like to store sessions in a Postgresql database. I found this tutorial on Stackoverflow and followed Diego Pino's directions. However, when I got to the ...

1 2
15 30 50 per page