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

learn more… | top users | synonyms

0
votes
1answer
12 views

Adding Default Value to Column Depending on the Value of Another Field in A Model In A Rails 3.2.13 Database Migration

I already have a date field (string) in my model. I plan to add other string fields with different long date formats to use in a text search related to the existing date field. This is to facilitate ...
0
votes
1answer
13 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 ...
2
votes
0answers
86 views

How to make an array sum of month from Postgresql query to Rails 3

I'm new in programming but here's the thing: I'm trying to make rails app which takes data from postgresql database and shows summary in jqPlot chart, but I am having trouble with my queries. I need ...
0
votes
1answer
26 views

Postgre SQL incorrect syntaxt near If

I'm trying to create function but it's having error at If statement don't know what's the problem with it. CREATE FUNCTION uspgetcountrylistwithpagenumber(IN "PageNumber" integer, IN "PageSize" ...
1
vote
1answer
31 views

Postgres: average user response time from interaction with a bot

I have a table that stores all messages between users and a bot (basically a state machine), and I'm trying to find all pairs of message/response from this table, in order to calculate each user's ...
0
votes
1answer
37 views

Rails - Generate email address when one doesn't exist with Omniauth integration

I am working with omniauth with Rails and trying to get twitter, facebook and google hooked up for authentication but keep running into this error: PG::Error: ERROR: duplicate key value violates ...
0
votes
0answers
28 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
39 views

find_each with order and limit

I need to limit and order batches of records and am using find_each. I've seen a lot of people asking for this and no really good solution. If I've missed it, please post a link! I have 30M records ...
1
vote
0answers
14 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 ...
2
votes
1answer
277 views

Can't store array in json field in postgresql (rails) can't cast Array to json

This is the error I'm getting when I run db:migrate rake aborted! can't cast Array to json This is my table class CreateTrips < ActiveRecord::Migration def change ...
0
votes
1answer
128 views

Querying a PostgreSQL multi-dimensional array data type in Rails 4

I am using a PostgreSQL multi-dimensional array to mimic an array of hashes, and I am looking for a way to locate a record by a key-value pair in that array like e.g ["key1","value1"]. An example ...
1
vote
4answers
90 views

Rails multitenant architecture, scoping access to multiple tenants

We have a single-tenant database architecture at the moment with MySQL running upward of 100 databases. We switch database connection on subdomain using the Apartment gem and all is dandy! However, ...
3
votes
1answer
326 views

RSpec, Rails 4, Postgres, UUID primary keys: id is null with Rake + RSpec, but is fine in RSpec or console

I'm trying to get up and running with UUID primary keys for a model with Postgres and Rails 4.0.0.rc2, but my specs are failing to create and destroy, yet MyThing.create or MyThing#destroy works fine ...
0
votes
2answers
43 views

Creating a scope to compare 2 dates

I have a model called Feed that records two timestamps, Last_visited and Last_modified. I'd like to render a list of feeds where last_modified > last_visited I currently have this scope in my model: ...
0
votes
1answer
81 views

Connection refused (PGError) (postgresql and rails)

I keep getting this error when i try to run my localhost using "$rails s": (Mac OSX 10.8.3) (ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.3.0]) (Rails 3.2.11) (psql (PostgreSQL) ...
0
votes
0answers
50 views

Rails - PostgreSQL group by and order by another

I have a score model where users can play and add scores. When I pick the highscore I don't want to let users have more than one score on the scoreboard. Therefore I need to sort the score by points ...
0
votes
0answers
54 views

$ rails db fails with error, but database is working fine

My Rails 3.2 app is using a PostgreSQL database. It's working great locally. I can migrate and interact with the application through the browser or irb. However when I run $ rails db, I get an error: ...
0
votes
0answers
26 views

trigram search returning <PgSearch::ScopeOptions::DisableEagerLoading:0x3fce0aef3130>

In my NewContact model, I have the following: pg_search_scope :contact_from_search, :against => [:first_name, :last_name, :email], :using => { ...
0
votes
0answers
80 views

Rails + PostgreSQL: How Do I save TimeStamp Values?

I'm building an API on Rails w/ Postgres, and users will be sending GET, POST & PUT requests of timestamps. I will not be handling timezones. It's up to the users to submit in UTC. So, what ...
0
votes
1answer
56 views

Rails Heroku database missing data

I'm new to Rails and Heroku. I don't partly understand system of databases (testing, production, development). I created two Rails apps. First with Rails' default sqlite db and second with ...
0
votes
0answers
51 views

activerecord uncached method not working for postgresql

I have a rails app that uses postgresql and I want to temporarily disable query caching for the purpose of testing my query times. The following solution works for sqlite database, but i have been ...
0
votes
0answers
38 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 -- ...
0
votes
0answers
112 views

rails g scaffold! uninitialized constant in development environment

I got my ror development environment setup on ubuntu 10.04, using postgresql database. I was doing a test to generate a scaffold when I got: <module:AppName>: uninitialized constant ...
1
vote
0answers
39 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 => ...
0
votes
0answers
22 views

Rails Join Table Issues

In my app there is an Athlete and this athlete has many sports (joined through a user_sports table). Now, each sport has a position (Pitcher, Third Base, etc). Where I am stuck at is trying to ...
0
votes
0answers
68 views

radio button counter in database

Ruby on Rails beginner here. extremely simple question.I have a form with 4 radio buttons. a,b,c,d. everytime a user selects one of the four options and hits submit,i want the value incremented by 1 ...
1
vote
0answers
83 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 ...
0
votes
1answer
132 views

Rails PG::Error Presentation and Handling of Unique Constraint

I am developing on Rails 4 with postgres and devise. I have the following User model: # user model class User < ActiveRecord::Base extend FriendlyId friendly_id :username, :use => :slugged ...
0
votes
0answers
54 views

Rails apartment switch schema per session

I have an application, where every user has to have his own schema in postgres database. Now I use apartment gem, but it allows just to switch schema globally per whole application, not per every ...
3
votes
1answer
72 views

How can I include big support databases in my RSpec tests?

I have 3 large read-only databases that support my Rails 3.2 application in that values in them are examined and some of them stored along with ancillary information in my main database. I have these ...
0
votes
1answer
204 views

Using Postgresql with Amazon Opsworks - Getting IP address in database.yml

I'm trying to get a basic rails app working with Postgres using Amazon Opsworks. Opsworks lacks built-in support for Postgres at the moment, but I'm using some cookbooks that I've found which seem to ...
0
votes
0answers
61 views

rails select method and scope

On my user model I have these scope method class User < ActiveRecord::Base scope :active, where(:deactivated => false) end I am using Amistad gem for handling friendships between ...
0
votes
0answers
142 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 ...
0
votes
0answers
77 views

Rails order and kaminari pagination

I am using kaminari gem for pagination in my rails 3 application on my album controller @albumcomments [email protected](:created_at).reverse_order.page(params[:page]).per(4) and I am ...
1
vote
1answer
67 views

postgreSql and Rails order

Using PostgreSQL on my Rails application but rails method Order is not working. @[email protected]("created_at DESC") It gives me the same results as ...
0
votes
0answers
95 views

Receiving PG::Error when trying to save GeoJSON to Postgres / PostGIS database. What's missing?

I'm using Rails 3.2 with a Postgres / PostGIS database and the following gems: pg (0.15.1) rgeo (0.3.20) rgeo-activerecord (0.5.0) rgeo-geojson (0.2.3) activerecord-postgis-adapter (0.6.2) The ...
0
votes
0answers
85 views

Can't configure postgres on local machine to work with rails application

I have an existing rails application. My database and application seem to work fine on the remote database (I made changes on my local machine but am still connected to the remote database), but I ...
2
votes
0answers
231 views

Redis conflict with postgres - error 'database configuration does not specify adapter'

Problem: I added Redis to my Rails app, using postgresql (pg gem, redis gem), and now can't deploy to my staging environment. Cap fails with this error message, after db:schema:dump: database ...
0
votes
1answer
101 views

Why is Brew installed postgres looking here?

Why is brew installed postgres looking for /tmp/.s.PGSQL.5432 when I specified /var/pgsql_socket (unix_socket_directory = '/var/pgsql_socket') in my postgresql.conf? Install was successful. I can ...
3
votes
1answer
322 views

Heroku Rails could not fork new process for connection: Cannot allocate memory

I have 3 Rails applications that all use the same code base. 2/3 of the applications are running fine, but one of them gives me this error: could not fork new process for connection: Cannot allocate ...
0
votes
0answers
80 views

How to insert special characters and keywords into database using `ActiveRecord`

I've exported application code from a Ruby On Rails app that needs to be inserted into PostgreSQL and MySql using ActiveRecord. I've tried different escapes, but no luck. I've tried E and $$ for ...
0
votes
1answer
35 views

Rails: last migration reapplied

Sometimes rake db:migrate tries to run migrations which have already been successfully migrated (without any errors). When I check the schema_migrations table, the repetitive migration is not there. ...
0
votes
0answers
25 views

Strange ActiveRecord bug with join table (Postgres)

I came upon this bug when trying to make a Kickstarter clone for fun. My model for the join table does not work when called directly. When I try it in rake console, I have to type in the plural ...
1
vote
1answer
119 views

Why can't my app modify development postgresql database after migrating from SQLite?

I switched my development database from SQLite to postgresql. My app worked in both development and production (Heroku, postgresql) but now I cannot modify, delete or create records in the new ...
1
vote
0answers
128 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 ...
0
votes
0answers
89 views

Postgres error on Heroku causing ActiveRecord::StatementInvalid

I run a Rails app / website (Rails v.3.0.3) with some 10.000 pageviews a day but sometimes, when Digg.com or similar links to it, I get 2 or 3 times that traffic. When that happens I tend to get a ...
0
votes
0answers
44 views

Abstracting full text search with postgres

So I have a database on a Rails application that uses postgres for full text searching on one model. I would like to abstract this to do full text searching on several different models with it's own ...
0
votes
0answers
92 views

Active Record locking Postgres database, possibly related to Carrierwave?

I'm seeing occasional timeouts in my Rails 3.2 app that seem to be the result of the database locking rows for an extended period of time. I am using a production level DB on Heroku. I see many ...
2
votes
0answers
86 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
141 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]: ...

1 2 3 4 5