0
votes
2answers
20 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
37 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
15 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
1answer
31 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
30 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
20 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
25 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
39 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 ...
-2
votes
0answers
30 views

i need help in installing the pg gem? [on hold]

Christopher-MacBook-Pro:`rails_projects jtorkornoo$ gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config` Building native extensions with: `'--with-pg- ...
0
votes
1answer
16 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
9 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
27 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
34 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
26 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
14 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
9 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
33 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 ...
0
votes
0answers
30 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
17 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 ...
0
votes
0answers
19 views

Schema is unsaved, full of local/ external changes, forgot to commit for the past few hours. But I think I just need confirmation on what to do

Um, not really sure what went wrong here. I ran a migration with my schema file open, which I've done before and it's always been fine. But this time it didn't save. And then I noticed # These are ...
1
vote
3answers
54 views

Sort a list based on number of votes

I am trying to create a new list of a old list that contains all the "Stories" of my site. Every story contains of several chapters which has a number of votes on them. I want a new list with all ...
0
votes
1answer
19 views

Rails - SQLite3::SQLException: near “USING”: syntax error

I've recently deployed my app to Heroku and in doing so I had to make some amends to a couple of columns in one of my tables. Specifically, I did the following: class ChangeCancelColumnOrders < ...
1
vote
0answers
28 views

Page loads different versions when pressing Ctrl+R

I have a problem with the page which I edit from my site admin (no CMS used), it have different versions based on all edits by admin user (me). When I go to that page on the site as normal user (who ...
0
votes
2answers
43 views

How to eliminate the use of this class variable

Ruby 2.0.0, Rails 4.0.3, Windows 8.1 Update, PostgreSQL 9.3.3 I have built an XLog class that allows me to write records to PostgreSQL from within any controller in my application. However, it's ...
1
vote
2answers
47 views

Can't Load Rails Server Even Could not find pg-0.17.1 in any of the sources

pretty new to all this and ran into a real ditch. I had ruby 2.0.0p353 running with rails 4.1+, everything was setup with homebrew, xcode, git,heroku etc.... I'm on OSX 10.9.4 then came time to try ...
1
vote
1answer
40 views

Ruby on Rails - Handling of DateTime.current and User Input Time

I'm using Rails 3.2.9 with Postgres database and JRuby 1.7.12. Application is running Ubuntu Server with GMT+7 Asia/Bangkok Time Zone. config.time_zone is set to Bangkok Postgres timezone is also ...
-1
votes
0answers
43 views

Moving local ROR app to Heroku/Git

I am trying to get my app into production in Heroku. I have made the necessary database chnges from sqlite3 to postgresql in my gem file and made a change in database.yml file by changing production ...
-2
votes
0answers
39 views

PG Gem not installed correctly? [closed]

Note This question does not need to be closed. None of the proposed solutions at the time of this update apply. I have rails 4.1.x and for postgres I am using the postgres app, I did the following to ...
0
votes
1answer
41 views

rake test:prepare fails with Rails 4.0.8

I was testing my app (with rspec) when I noticed rake test:prepare throws an odd FATAL: database "postgres" does not exist error. Stranger still, my tests run just fine regardless. However, whenever ...
1
vote
1answer
16 views

Rails changes postgres SELECT * to SELECT COUNT

I am working with the RailsCast on token input and am trying to cleanup a query method for Postgres. I found this post for making my query DB-agnostic. My method: def self.tokens(query) t = ...
0
votes
1answer
21 views

SimpleForm position for boolean variable is odd

Ruby 2.0.0, Rails 4.0.3, Windows 8.1 Update, SimpleForm 3.0.1 I'm just trying to build a basic form for a new associate, and I cannot get the Boolean variable :shared to line up. I've tried to ...
1
vote
2answers
50 views

SQL - where queries on join table

I'm trying to query a table, listings, based on a has_many relationship with listing_options. Listing options have different types and I'd like to make a SQL query that can match listings with ...
0
votes
2answers
41 views

Rails gives error when using postgresql

Rails is giving this error: active_record/connection_adapters/connection_specification.rb:190:in rescue in spec': Specified 'sqlite3' for database adapter, but the gem is not loaded. Addgem ...
0
votes
1answer
21 views

Devise primary key error on postgresql, heroku, Rails 4 [duplicate]

It is really odd, I'm trying to create a new user by command line and I'm getting this error: User.create :email => "[email protected]", :password => '123456789', :password_confirmation => ...
-1
votes
0answers
37 views

How do I make multiple instances of a method run simaltaneosly in ruby?

I am trying to migrate to discourse. I have a mysql dump and I am running phpbb3.rb migrating script for doing it. There are more than 3 lakhs user records in it which will take few days to complete. ...
0
votes
0answers
16 views

Rails 4 belongs_to and has_many with inherited models (using STI with postgres hstore)

I have a person model that inherits party, and just to complicate things further, I implement the inheritance (STI) using Postgres' hstore. My (simplified) model definitions are as follow: class ...
0
votes
2answers
101 views
+150

Heroku - ActiveRecord::ConnectionTimeoutError (could not obtain a database connection within 5.000 seconds (waited 5.000 seconds))

I have a fairly straightforward application which is running without problem locally, but when deployed to heroku it quickly stops working with a 500 error and the following error in the logs: ...
0
votes
1answer
37 views

rails application running out of database connections

Even though I have a pool of 50 in my Rails application, I also wrote a script that handles tasks periodically using the popular daemons gem. This is what it looks like: class Responder def ...
0
votes
1answer
29 views

Rollback migration that changes column type from string to text where db is postgresql in rails 3.2

I have understood the solution for changing the column type from string to text while using postgresql and rails 3.2 provided here. I have also implemented it. But when I rollback this migration, it ...
0
votes
0answers
9 views

thinkingsphinx with postgres

I'm running thinking-sphinx/postgresql and I have the following problem. When I index my database table, I defined my stuff_index.rb as follow: ThinkingSphinx::Index.define :stuff, :with => ...
0
votes
0answers
23 views

Optimizing a slow ActiveRecord query using sql, but getting worse result. Why?

I have a slow query that is timing out: orders.each do |order| if order.created_at < new_revenue_end new_revenue += order.total_cost + order.credit_used else old_revenue += ...
0
votes
1answer
12 views

Rails association scope for “more than one associated object”

Given two associated models class Employee < ActiveRecord::Base belongs_to :company end class Company < ActiveRecord::Base has_many :employees end How would I make a scope on "Company" ...
0
votes
1answer
20 views

Postgres - How to create index for simple association directly (outside of activerecord)?

We have a Postgres database that is populated through a node app that parses XML and loads our dataset for us. We have built a Sinatra app to view the data. We have a number of archive_objects which ...