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 ...
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
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
26 views

Rails Query for models that contain both/multiple associations

I have model Book and Books has_many Authors. I would like to find all the books that have associations with two different authors. The relationship is HABTM. To find the number of books with one ...
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
31 views

Reload on user-object reverts changes made on its array field in db

I have an User model which has an array of roles. From my schema.db: create_table "users", force: true do |t| t.string "roles", array: true My model looks like this: class User < ...
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 ...
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
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) ...
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
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
0answers
22 views

Adding Username login to Devise in Rails 4 - Error creating User

Login works fine after following this guide: Allow users to sign in using their username or email address However creating a new User does no longer work. This is what I am getting: Started POST ...
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 ...
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
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 ...
1
vote
3answers
55 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
2answers
44 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
49 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
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 ...
0
votes
1answer
45 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 ...
0
votes
2answers
47 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 ...
-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
1answer
39 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
40 views

Gem install pg works but bundle install fails

There is very lot of topics about this but I already try almost all of them with no success. I'm on Mac OS X 10.9.4 Mavericks, I have the Postgres.app, and it seams to work fine, sudo gem install pg ...
0
votes
1answer
21 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 ...
0
votes
0answers
19 views

Copy a row in one schema of a postgresql DB to another schema in Rails

I am developing a multi tenant application in rails using the Appartment Gem. I have a requirement where in I have to copy a row from a table with public schema to the same table in tenant schema. ...
0
votes
1answer
45 views

script to download heroku postgres DB dump to local server

I would like to create a script that would make a dump of a postgresql DB on heroku and download it to my local server. I using windows server 2008 R2 and would assume that this would be activated ...
0
votes
1answer
38 views

Selecting rows where array elements in Array Rails ActiveRecord/SQL

In Rails 4/Ruby 2.1, I'm trying to do something like this: @user.submissions.where(:submission_codes_array => valid_submission_codes_array).count Sort of similar to when you want to see if the ...
0
votes
1answer
48 views

What does my timestamp come from the future?

I'm displaying events from a PostgreSQL database, and my timestamps show as if they are going to happen in four hours.. Using select * from event in my database shows the correct timestamp. Why is ...
0
votes
1answer
47 views

Rake DB:Create will not connect to PostGresql and set up database

I've got a rails projects whose git repository I've forked and downloaded onto my computer. It's running for the other people on my team, however, when I run rake db:create I get the following ...
0
votes
1answer
21 views

Warning message in log files each time I run a rake task

I have a rake task that outputs this warning message to the log. ".rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/memoizable-0.4.2/lib/memoizable/method_builder.rb:117:in `call': [DEPRECATION] ...
0
votes
2answers
24 views

Rails - PostgreSQL boolean where statement, ERROR: operator does not exist: boolean = integer

I have a model that contains a boolean attribute, Member can be admin. When I create a new Team I want to set this value to true for the Member that have created that Team. When I used SQLite it ...
1
vote
1answer
31 views

Comparing two dates in ruby on rails giving error - “can't convert Date into String”

I'm getting the error while comparing two dates in ruby on rails, I'm using PostgreSQL as my database. exp_date = ps.expiry_date if Date.today < Date.parse(exp_date) Good else Expired ...
1
vote
2answers
26 views

Efficient way to get data from an array of non primary-key IDs?

I have a Ruby/Sinatra app, in which I am receiving and parsing a JSON string of images such as: [{"id" => "ABCD123", "type" => "image"}, {"id" => "ABCD234", "type" => "image"}, {"id" ...
0
votes
1answer
31 views

Sphinx joining indexes with certain logic

I've been researching and researching.. and I couldn't find a way to get results by joining (as on sql with two tables) with some logic, I mean, I want to have a list of results by matching "things" ...
1
vote
1answer
30 views

Resume of product query

I have the following schema table: I have three activerecord models with their associations. I am struggling with a query which will show the following information for each product: Product Name, ...
3
votes
1answer
34 views

Rails 3 NoMethodError (undefined method `unserialized_value' for “— []\n”:String):

I am using Rails 3.2.13 and postgress. I am getting below error only in production server NoMethodError (undefined method `unserialized_value' for "--- []\n":String): ...
0
votes
1answer
39 views

ERROR: Failed to buil gem native extension because PostgreSQL is too old

I'm attempting to run bundle in my Rails project on Mavericks. It fails when getting to the pg gem with this error. It said Your PostgreSQL is too old. Either install an older version of this gem or ...
0
votes
0answers
28 views

Formatting Postgres row_to_json response for query

I have the following Postgres query: "SELECT \"responses\".\"index\", \"responses\".\"created_at\", ROUND(AVG(\"responses\".\"numeric\")) AS numeric FROM \"responses\" WHERE \"responses\".\"time\" = ...
1
vote
1answer
32 views

Can't access methods of postgis

I try to build my rails env with postgis. The following is the extension of my db: List of installed extensions Name | Version | Schema | ...
0
votes
1answer
37 views

Ruby 'pg' gem linking to wrong copy of libpq.5.dylib (on OSX)

The EnterpriseDB installer for PostgreSQL 9.3 places its files in /Library/PostgreSQL/9.3/* on Mac OSX. However, the Ruby gem 'pg' loads a legacy version of the 'C' dynamic library libpq.5.dylib from ...
1
vote
2answers
86 views

gem install pg not working while doing bundle install / RoR

edit What worked for me was running: brew doctor I then had to chown a few files and delete a few things it asked me to. I then ran sudo gem install pg and it worked. Not sure why it only ...
1
vote
2answers
112 views

Getting error - type “json” does not exist - in Postgresql during rake db migrate

I have recently cloned a project to my local Ubuntu box now that I am remote, and upon rake db migrate, I get the following error: PG::UndefinedObject: ERROR: type "json" does not exist A couple ...
0
votes
1answer
47 views

Cannot install PG gem on Mac OSX

I created a new rails app: rails new -d postgresql However, I cannot get the pg gem to install. I had previously installed postgres using brew and it starts up automatically with my Mac. I have ...
0
votes
2answers
63 views

Rails Raw SQL WHERE clause

I'm making raw sql queries into my PG database in Rails. When I use only one date condition in the WHERE clause works perfectly, but when I use 2 date conditions it doesn't work as expected. To view ...
0
votes
1answer
73 views

Elastic Beanstalk Passenger-Standalone Rails not serving static assets

When I use aws.push to deploy my rails 4.1 app, it doesn't serve any of my static assets. Everything works but no css, javascript or images. When I try to run: RAILS_ENV=production bundle exec rake ...