0
votes
0answers
15 views

Automating the reset of Max ID in PostgreSQL Table after CSV import in rails

In my application, I use CSV import to add content, however, after a CSV import, when I try to create a new object, I get an error saying that the IDs conflict. I have figured out how to solve this ...
1
vote
1answer
22 views

Rails & postgres - reindex after restore

Recently I ran into a situation where I had to restore a backup database from Heroku to my local setup because of a configuration error I had made. This was very straight-forward from a Heroku post: ...
0
votes
1answer
18 views

Ordering postgres database with ASC

I am trying to get my list of skills to be showed in alphabetical order. I have checked on: http://guides.rubyonrails.org/active_record_querying.html#ordering and am using this line in my Skill.rb ...
0
votes
1answer
7 views

Migrating a Postgres Table in Rails to Ensure a combination of column values is unique

In postgres you can do the following: CREATE TABLE example ( a integer, b integer, c integer, UNIQUE (a, c) ); Is there anyway to specify that a combination of values on two columns must be ...
2
votes
1answer
29 views

RAILS 4 ACTIVERECORD Retrieve newest records by key

I have a table in my DB (PostgreSQL) which is roughly as follows: Currency Rate Created_at USD 13.5 08/07/2014 EURO 18.5 08/07/2014 USD 13.3 08/08/2014 EURO ...
0
votes
1answer
29 views

rails activerecord sum works with .each but not with others

I am trying to calculate balance in activerecords, one works and the other doesnt. 1=> why is this does not work to get the balance: @accounts_balances = Account.select('(sum("in")) - (sum("out")) ...
1
vote
1answer
19 views

Rails: track users group by hour created_at and ip address

I have the following impression model that tracks all users interactions within the app: class Impression belongs_to :user end create_table :impressions do t.string :ip_address t.integer ...
0
votes
2answers
36 views

Matching array values in PostgreSQL with ActiveRecord

In my Rails 4 app I have a goal to see all contacts, where field visible_to in contacts table equal to 1. My visible_to is :integer, array: true. However, I get the following exception: ...
-1
votes
0answers
20 views

ActiveRecord::StatementInvalid: PG::Error: ERROR: Array value must start with “{” or dimension infromation

when to insert a new record into searches table following error occurred. ActiveRecord::StatementInvalid: PG::Error: ERROR: Array value must start with "{" or dimension infromation Here is the ...
0
votes
1answer
17 views

ruby on rails can't connect to postgres got PG::Error: fe_sendauth: no password supplie

I'm trying to run a local canvas instance on my mac(os 10.9.4) following this guide: https://github.com/instructure/canvas-lms/wiki/Quick-Start Before I fired up the canvas server I needed to ...
0
votes
0answers
11 views

Exporting database data analysis to excel

I would like to create an export button or rake task for analyzing my database. I am using Rails 4, postgresql, and ActiveAdmin http://www.activeadmin.info/docs/4-csv-format.html. ActiveAdmin exports ...
0
votes
0answers
18 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
2answers
20 views

How to deploy to Heroku without losing tmp files?

I have a scheduled job running every 12 hrs that unzips image files from an FTP server into my tmp folder. The problem is that due to Heroku's ephemeral filesystem, whenever I deploy new code, the tmp ...
1
vote
3answers
40 views
+100

rake db:setup results in fe_sendauth no password supplied

When I run: rake db:setup i get: fe_sendauth: no password supplied Couldn't create database for {"adapter"=>"postfresql", "encoding"=>"unicode", "host"=>"localhost", "pool"=>5, ...
0
votes
0answers
15 views

How can I tail error logs on centos 6 server for rails app?

I have created and built a server on Digitalocean and its a centos 6 server with nodejs running and rails installed on top of it. Its has nginx and passenger running together and I am deploying with ...
0
votes
1answer
34 views

Postgres Postgis error: Library not loaded: /usr/local/lib/libspatialite.5.dylib

So this error has been driving me crazy. Background: While browsing through a postgres-rails app in development, I came across a page error-ing out due to a PG error. Thinking my current git branch's ...
0
votes
1answer
17 views

Call one Ember Model in another?

I am using ember backed by rails and postgresql. I am trying to access one model's data within a different model. My models are like this: App.Name = DS.Model.extend calc_name: DS.attr 'string' ...
0
votes
1answer
20 views

schema.rb - dump errors - NoMethodError undefined method `default_function'

I went to look at my schema.rb file and found the following: ActiveRecord::Schema.define(version: 20140729164926) do # Could not dump table "account_services_indices" because of following ...
0
votes
1answer
20 views

Connecting rails with storage services on a coreos cluster

How can I communicate a Rails application with a Postgres DB on a CoreOS cluster? Obviously I can't hardcode storage locations under database.yml
1
vote
1answer
20 views

Connecting rails with storage services on a mesos cluster

How can I communicate a Rails application with a Postgres DB using Zookeeper, Marathon and Mesos? Obviously I can't hardcode storage locations under database.yml
0
votes
0answers
15 views

Why is Capistrano failing deploy with Ident authentication failed for user “postgres”

I have setup a Capistrano deploy in my site and I am trying to deploy to a staging server. The server is a CentoOS 6 server with nginx and passenger running through with it. Everything runs okay ...
0
votes
0answers
13 views
+50

ransack using ransacker for interger to_char

I'm attempting to use the ransacker method to convert one of my fields from integer to string with the following ransacker :invoice_no do Arel.sql("to_char(invoice_no, '9999999')") end I'm using ...
0
votes
1answer
19 views

Issue creating new route-view in Ember

I have been following along the Vic Ramon's Ember tutorial (I'm new) and I was able to successfully create CRUD interface that work back to 1 postgres table. http://ember.vicramon.com/our-app I ...
0
votes
1answer
17 views

Find out which DB Heroku is currently using

I recently had a short term project served off of Heroku that approached 10,000 Postgres records and needed to be upgraded from hobby-dev to hobby-basic. Being new to Heroku, I did my best in finding ...
0
votes
0answers
19 views

PG::UndefinedColumn, Rails_Admin

Rails rookie here. Horrendous understanding of the backend. But trying. When I attempt to edit a product in my admin section (rails_admin), I get the following error message: ...
0
votes
2answers
23 views

PG::Error: ERROR: column reference “status” is ambiguous in active_admin

Using rails 3.2 with active_admin and seeing PG::Error: ERROR: column reference "status" is ambiguous when using a custom filter on active_admin in Rents.rb: filter :travel_car_brand, as: :string ...
0
votes
3answers
47 views

Make Ruby on Rails application available within network

So I have a web application developed in Ruby on Rails 4.0 and accessible on my local PC via localhost:3000 (after I start the rails server by running rails s in cmd at the root of the app). It is of ...
0
votes
0answers
25 views

Load a json object from postgres into ember-data via rails?

I am trying to create an Ember.js app where in the model, I load in a JSON as an object. (Just to display for now.) Here is my rails schema: create_table "recipes", force: true do |t| ...
1
vote
1answer
26 views

strftime error on Heroku

Am new to RubyOnRails, am getting strftime error on Heroku machine, Below code is heroku log for verification. 2014-08-03T15:15:06.051867+00:00 app[web.1]: ActionView::Template::Error (can't convert ...
0
votes
0answers
43 views

Adding Postgresql to rails app

I am running Mac OSX 10.9.4, rails 4 I am trying to add Postgresql to a rails app to deploy to heroku. However, I cannot seem to bundle install it. And when i tried: rails new myapp -d postgresql ...
0
votes
2answers
32 views

Adding to seeds.rb of an existing project, Validation errors and undefined methods

I've been tasked with adding seeds to an existing Rails project. I've been given a list of twelve survey names and I'm supposed to create them all, storing their id (position in the list of surveys) ...
1
vote
2answers
21 views

Sort in postgres in ascending order with 0 last

So I'm trying to sort by the day of the week 0 - 6 (Sunday - Saturday), but I want Monday first. So in my database, I'm storing the day of the week with Sunday first which is 0. But can I sort it so ...
0
votes
0answers
19 views

Rails Scopes without SQL requests

Let's say I have User and Event. An user has many events. The Event class has this scope: scope :published, -> { where(published: true) } Now, every time I do: user.events.published it's gonna ...
0
votes
0answers
26 views

RoR: 'NameError Exception: uninitialized constant Address' when trying to access recently added data from a populated postgresql table

I have created a Ruby script that inserts data into a PostgreSQL database. The db exists and so do the tables. I have an Address model and a Company model in my app and those two are connected ...
0
votes
4answers
43 views

Order by count on multiple associations

I have a post model. A post has_many comments, has_many favorites, and there's a column on the post model called views. I want to order posts by the sum of all 3 of these counts. How can I achieve ...
0
votes
0answers
8 views

Order based on existence of tag, acts-as-taggable-on gem

I'd like to order a query based on the tags associated with a product. If the tag exists it should be placed at the bottom of the query. I am using the acts-as-taggable-on gem to manage tags for the ...
0
votes
1answer
21 views

Start postgres server downloaded from ruby gem on ubuntu

When I run rake:db migrate from my rails app, I get this output: rake aborted! PG::ConnectionBad: could not connect to server: Connection refused Is the server running on host "localhost" (127.0.0.1) ...
0
votes
0answers
10 views

How can I revert the concatenation of paper_trail versions on 2 separate objects?

Background: We have a system for approving employee hours. One object, UnapprovedEmployeeAssignment (UEA), gets created when someone submits hours for the payroll admin to approve. Upon approval, the ...
0
votes
1answer
30 views

Pulling down from github, unable to work locally with postgreSQL

I cloned a repository in a RoR app using postgres but I'm unable to work locally. When I run the server I get this error: could not connect to server: No such file or directory Is the server running ...
0
votes
1answer
36 views

Unexpected behaviour for time comparisons

OK so i have a record that was created 26 days ago but when i do a comparison to 2.days.ago it tells me false i don't know why, i've been at this for like 3 hours trying several things and doing a lot ...
0
votes
0answers
29 views

Rails pagination duplicate rows

I am getting duplicate entries when I fire sql query with offset 0 and 50. Employment has many feedbacks. Database is PG. I have tried sorting also by feedbacks.uuid and employments.uuid, but with no ...
0
votes
1answer
27 views

Warning: Data in the database will be overwritten and will not be recoverable

I want to unload my application on ROR on Heroku. I unload my application on Heroku, but I have no database. What I should do that my database unloaded on Heroku. I received many errors. One of this ...
1
vote
0answers
22 views

Is there a gem that will notify when JOIN/WHERE query is used on column(s) without an index in Ruby on Rails and PostgreSQL?

Is there a Ruby gem or PostgreSQL extension that would notify when JOIN or WHERE query is used on column(s) without an index?
0
votes
0answers
18 views

Postgres connection timeout error on heroku rails

I have looked around for many questions on stackoverflow but have not found a solution yet to my problem. I was running rails 4.0.2 on heroku with the default webrick server and it was working fine ...
0
votes
0answers
12 views

Different database for my application's tables and RefineryCMS's?

I'm starting a RefineryCMS project for the first time after being over fed up with Wordpress, and having created several application in Rails. However the deployment process is somewhat confusing for ...
0
votes
1answer
36 views

Rails one to many through a relationship table

I have a Company that has many Users through a join table company_user. Each user should work for only one Company. This is a 1 to many relationship. I have looked around for this and found the ...
1
vote
1answer
15 views

Using Sequel to access postgres database in decoupled Rails app

Can anyone tell me why I'm getting a "no database associated with Sequel::Model" error when trying to run specs in a decoupled rails app? My postgreSQL database has already been created and seeded ...
1
vote
1answer
33 views

Has Many Through w/ Conditions

I'm using a has_many through relationship in Rails 4, that looks like this: has_many :collection_memberships, as: :collectable has_many :collections, through: :collection_memberships has_many ...
1
vote
0answers
35 views

Why does my rails app ignore the env var DATABASE_URL at console startup?

tl;dr: $ export DATABASE_URL=postgres://user:pwd@localhost:5432/new_db $ RAILS_ENV=test bundle exec rails c [1] pry(main)> ActiveRecord::Base.connection.current_database => "test" [2] ...
1
vote
1answer
18 views

Rails full text search PgSql

I am working in rails 3.2 and using pgsql, Thing is I want to implement full-text search functionality and after so much googling I did not found anything relevant. Right now I am using search with ...