1
vote
2answers
24 views

ActiveRecord Query Failing For Name Containing Accented Characters

I have a Rails app using Postgres. I have a Document model that has a name attribute. Some names contain accented characters. A couple of example names: Condições Para Aplicação Da Lei ...
0
votes
1answer
26 views

Active Record Query - Search Multiple Columns for Multiple Strings and Return Only if They Are All Included

I need help designing a query via Active Record & Postgresql. • The query must search across all of the following columns... The Model looks like this: Collection item_id1: String ...
1
vote
0answers
25 views

Rails background worker seems to be wrapped in a transaction

I know how useless and vague the title is. Sorry. I don't have much other than some observation and evidence that nothing changed in my code. I have a Rails 3.2.14 app using DelayedJob and PostgreSQL ...
0
votes
0answers
38 views

heroku error while deploying app

It's first time I'm trying to deploy on heroku. Short description of taken steps: I use heroku gem(probably should be using heroku toolbelt) In production I use postgres and thin server, in dev ...
5
votes
6answers
1k views

rake db:migrate not working on my postgres db

Ok so i have a rails application that I am attempting to run the migrations on a postgres db and I usually use mysql and all is good but when i run the command i get this rake db:migrate (in ...
0
votes
1answer
22 views

Select records based off of an associated records count

I have three models: class Picture < ActiveRecord::Base # fields: url has_one :visit end class Visit < ActiveRecord::Base # fields: total_visits belongs_to :picture end class ...
1
vote
1answer
25 views

Ruby WHERE Clause - Listing Duplicate Objects(Postgresql)

I am working on determining the attitude of a post using AFINN 111, which can be found here. Whenever one of these words are mentioned in the post, their corresponding values are selected and added, ...
3
votes
1answer
50 views

sums return String, only with postgresql

I am migrating a database from mysql to postgres. The migration itself was ok, following the postgres documentation. Right now, I'm fixing our specific mysql queries. In some point, we have now ...
3
votes
2answers
235 views

SQL in postgres convert datetime for recurring event to future datetime

I'm keep track of recurring weekly events in a table using just a DATETIME. I only care about the TIME and the day of the week it falls on. I need to be able to convert the set DATETIME into the ...
0
votes
0answers
64 views

Rails Bundle Install/Update of PG Gem Failing Due to Bad Gemfile.lock entry

I am currently doing an upgrade of a Rails 2 app to Ruby 2 and Rails 3.1 (on its way to Rails 4) and have encountered a problem getting the Postgres (PG) Gem to bundle install/update. As part of this ...
112
votes
10answers
46k views

Can't find the 'libpq-fe.h header when trying to install pg gem on ubuntu

I am using rails 3.1 pre version. I like to use PostgreSQL but the problem is installing the pg gem. It gives me the following error: demonchand@system-001:~/exercise/personal/pro$ gem install pg ...
0
votes
2answers
40 views

Rails model update doen't work after cap migrate

I have a Rails 3.2 application and I have some issues on the production side: I have a model 'Poject' and did a migration to add a string for 'description'. running rake db:migrate works fine on my ...
0
votes
2answers
64 views

How to optimize/cache Rails query

I've Rails application where query takes way too long time. It uses postgresql DB and query consists of one table with thousands of records. statistics_controller.rb all_data = ...
1
vote
2answers
59 views

Rails with postgres - activerecord query: sort by column ASC, then group by column

I have a model Laps, which belongs to :Car So each car has many laps, but I need to do a query where i pull in the top 10 fastest Laps, but only pull in the fastest lap per each car. In other words, ...
0
votes
3answers
63 views

grouping with a non-primary key in postgres / activerecord

I have a model Lap: class Lap < ActiveRecord::Base belongs_to :car def self.by_carmodel(carmodel) scoped = joins(:car_model).where(:car_models => {:name => carmodel}) scoped ...

15 30 50 per page