1
vote
1answer
39 views

Postgres data type integer[] in ruby

ruby : ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.3.0] @user = User.find(1) User Load (0.8ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 1]] => ...
2
votes
1answer
35 views

Can't Save IDs from other tables into current table in database upon creation of an object Rails, Postgresql

I'm having problems getting multiple ids to save properly into my database. I have a listing that has two parameters: a listing id and a price. I've tried changing the controller to accept the ...
-3
votes
1answer
46 views

How can I get 20 users and 5 articles from each user? [closed]

Users can have many Articles. I want to get 20 of the most recent users and for each user, 5 articles. I was reading on http://wiki.postgresql.org/wiki/Find_recent_activity but this seems overly ...
0
votes
2answers
28 views

Problems with belongs_to condition in model

I'm making personal money management app. There I have 2 models: Account and Transaction. Transaction has belongs_to :account and Account has has_many :transactions. When I had account_id column in ...
0
votes
0answers
37 views

Postgres stopped connection on 127.0.0.1

I know this subject has been discussed, but none of the answers have helped me. Sorry, for starting a new topic on it...and thank you to anyone who helps. I have been developing on my local ...
2
votes
2answers
28 views

Is it normal/adviced to have “id holes” in my user table (rails 3.2/postgresql)

I am a total newbie, training myself building a basic Rails app on Heroku (using postgresql and as db client PGAdmin) I have a basic user table with name, email, password... I have noticed that when ...
0
votes
1answer
38 views

Calculate rank for multiple attributes

I'm building a motorsport timing app. As car's race around the track, Users input the split times for each Car into the app. The app then ranks each car at each split and displays this in my view. ...
1
vote
1answer
27 views

rails test and development databases are in different schema

I want to make benchmark tests but when I run rake test:benchmark I'm taking this kinds of errors ActiveRecord::StatementInvalid: PG::Error: ERROR: relation "contests" does not exist LINE 5: ...
0
votes
0answers
43 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
3answers
34 views

Static Read Only SQLite3 Database in Heroku

I will try my best to explain my issue. I have a SQLite3 database file of about 50,000 records that I compiled and use in my app. This database is read only and is only used to query and pull data ...
0
votes
1answer
28 views

gem install pg only works as sudo

I have read a lot on this topic, but seems like nobody has had the exact problem I am having. I am trying to install Postgres support for Rails 3 on Ubuntu. If I run: sudo gem install pg ...
0
votes
2answers
65 views

Rails: rspec fails after switching to postgreSQL

I'm learning rails and following the Ruby on Rails Tutorial Book. It had an extra challenge and taught me how to use postgreSQL instead of the default SQlite3. However, since I have changed to ...
1
vote
4answers
44 views

Can't deploy to heroku [heroku log included]

I'm having trouble deploying to Heroku, I've installed postgresql but I don't think I've configured it properly. This may or may not be the problem, but I have a hunch it has something to do with it. ...
0
votes
1answer
37 views

Rails, CKEditor, PostgreSQL, image upload with Carrierwave

When I try to insert an image into my blog I select the Upload tag and select my file and Send it to Server. Then at the URL tab I select Browse Server and I get the following error: ...
2
votes
2answers
43 views

Calculate offset of a row

I am writing a server side on RoR, which uses postgresql. Today I faced a feature, in what I need to identify the current offset of a row in the table. Client send me a unique identifier and I need ...
0
votes
2answers
152 views

Cannot run rake db:migrate, relation does not exist

I am trying to get a working app to work on linux 10.04 running on vagrant I installed all relevant gems, installed postgresql 9.1.9 and when I am trying to run rake db:migrate I am getting rake ...
0
votes
1answer
20 views

Rails Article.find 1 raises ActiveRecord::StatementInvalid on legacy database

I'm creating a rails app over a legacy database table. Everything works fine locally, but on the server I hit this error whenever I do Article.find(1) Could not log "sql.active_record" event. ...
0
votes
1answer
29 views

PostgreSQL management on Ubuntu [closed]

I'm looking for database management tool for PostgreSQL to host on Ruby. It would be nice to see and manage whole database and data on my Ubuntu VPS. Is there any tools for this? Maybe there is ...
0
votes
1answer
95 views

Complex Rails/Postgres SQL optimization

Restaurant has_many Dish Dish has_many Photo Photo belongs_to Dish Restaurant 1 Dish 1 Photo 1 May 9, 1:00 PM Dish 2 Photo 2 May 9, 2:00 PM Dish 3 Photo 3 May 9, 3:00 PM ...
0
votes
1answer
72 views

Rails on Heroku: ActiveRecord::StatementInvalid, resetting and migrating doesn't work

I'm getting the error below when trying to open the app that I just pushed to heroku, everything works fine locally. I've tried deleting and re-pushing, using rake db:reset, pg:reset, db:migrate and ...
-1
votes
1answer
59 views

Sort group of records based on different columns

I have a four columns in table called recordings such as score, event_id, user_id and I would like to sum the score of recordings based on user id + event id, and then I would like to show the users ...
1
vote
1answer
80 views

rake db:create:all FATAL : password authentication failed

I am trying to follow this railscast tutorial. Now I am in the step, where you create the database with rake db:create:all, but I got this error message : FATAL: password authentication failed for ...
3
votes
2answers
54 views

ActiveRecord query too difficult for my tiny brain

I have an activerecord model Event that I want to order by a rank. The rank will be a sum of weighted properties. For instance I might want to rank an event with some logic like: LOG(number of ...
2
votes
1answer
71 views

Order with a has_many relationship

I have Articles that have_many Metrics. I wish to order the Articles by a specific Metric.value when Metric.name = "score". (Metric records various article stats as 'name' and 'value' pairs. An ...
1
vote
1answer
216 views

(postgreSQL error) FATAL: role “demo” does not exist (PG::Error)

So I've just installed postgreSQL with HomeBrew and have initialized my new demo_app with the: rails new demo_app -d postgresql command. Albeit, I am getting the following error when starting up the ...
0
votes
1answer
51 views

we're sorry, but something went wrong on heroku when a user tries signing up [closed]

I can't correctly pinpoint what exactly is causing the issue This is a new website I just pushed to heroku, ran heroku rake db:migrate, and heroku restart It works just fine locally but this happens ...
0
votes
1answer
97 views

Rails Ransack search to get sum of association with conditions

Sorry if the title is unclear - I am not really sure how to word this question. I am using rails 3.2, postgresql, and ruby 1.9.3. I have two models: Order, which has many Items. Orders have a ...
1
vote
2answers
48 views

Error - heroku “insecure world writable dir /var/psql_socket in PATH”

Anytime I run things with my heroku app I am getting the following notice: /Users/username/.heroku/client/lib/heroku/helpers.rb:103: warning: Insecure world writable dir /var/pgsql_socket in PATH, ...
0
votes
1answer
48 views

Migrating existing rails app from SQLite to PostgreSQL

I saw some of the tutorials on how to migrate from sqlite to postgresql, but it is either for mac or it is for a new/fresh app. What if I already have an App with data sqlite in it. I am using rails ...
0
votes
1answer
34 views

Rails .where using AND / OR

I have a model Tasks that has the fields completed:boolean and completed_date:datetime. If a task is completed it will have the date when it was marked as completed, or else completed_date would be ...
0
votes
2answers
61 views

Checking if associated record exists in Rails

I have two tables: users and businesses. When a user logs in and accesses the business/profile I first want to check if they have created a profile. If not I will then redirect them to ...
0
votes
1answer
27 views

Adding foreign key to a rails model

I'm quite new to rails and have been trying to work this out all night with no luck. I have created 3 models: users, businesses, and business_hours. I have also added the associations (business_hours ...
0
votes
1answer
32 views

Does putting a limit to the size of a string attribute in Rails make the database smaller?

If I am using mySQL or Postgresql does putting a limit on the attribute shrink the size of the database? I guess this may be a silly question, but I am a little unfamiliar with how database size adds ...
3
votes
1answer
38 views

Rails and PostgresSQL issue with Having

I am trying to retrieve a table from the following Action table : Columns :ID, Name, Status, Product_ID, User_ID and several other non relevant column for this issue. Every time a user want a ...
0
votes
1answer
32 views

Customize deals app's homepage and emails thanks to user history: how to do it the right way on Rails/postgreSQL?

Am rather new to this site, looking forward to getting more involved :) I am building a daily deal app to better learn Ruby on Rails. I’d like to customize 1. The order of the deals on the ...
1
vote
1answer
71 views

Is it possible to have an Array of hstore in PostgreSQL

I am a complete beginner in PostgreSQL. And I was really amazed by the hstore datatype provided by Postgres. Well, I am using the Rails 3 framework and developing a simple app that uses PostgreSQL. I ...
1
vote
1answer
105 views

Postgres database username in database.yml file

How do I find out what is my database's username in my local machine? I'm updating my database.yml file in my rails application, but anything I try isn't working. When trying to use postgres (or ...
1
vote
1answer
40 views

How to update the same attributes in several tables with Postgresql and Rails

In order to minimize the number of joins that I have to execute in my application I decided to copy in my database the same field in several tables for example : I have a User, Product and a Wishlist ...
0
votes
2answers
85 views

How to store hash-like objects in a PostgreSQL database?

First, a bit of info. My Rails app has a model called Neo which in turn has attributes observed_at, ra and dec. However, I now found that I need to store sets of this data (in Python-like fashion it ...
0
votes
1answer
49 views

Can't view user profiles on my Heroku app after database edit

I just created an admin profile for my app on Heroku. I did this by going into my Heroku production database with pgAdminIII as described here, in the database I simply changed the admin field for my ...
2
votes
2answers
72 views

Why is ActiveRecord/PostgreSQL not finding my data in the database?

I'm sure this is something simple I'm overlooking but since I've been dealing with this strange issue for a few days now I'm asking for help. Here is my apps setup and the issue: A Rails 3.2.13 app ...
1
vote
2answers
48 views

Rake test failed - RunTimeError

I ran rake test and got the following error: /Users/username/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.7/lib/active_record/connection_adapters/postgresql_adapter.rb:1213:in `initialize': could ...
0
votes
1answer
25 views

Rails 3.2 - OR query not working properly - Rewriting query

I was really happy using this query for the search form. However, just found out that is not working properly. The failing bit is the .where which like against params[:query]. This like happens 4 ...
0
votes
2answers
95 views

Rails 3.2 - undefined method `where' for #<Array:… - Query of Model.where()

I am trying to compare fields from a given Header to other fields in the Alarm model. As you can see in the code I filter the alarms in 3 different steps. The first 2 work perfectly. However, the last ...
2
votes
1answer
35 views

Rails 3.2 - Query to extract records not working properly - Is this syntax correct?

I got 2 models. One called Header and another one called Alarm Alarm has a column called keyword. Header have 4 columns called title_en, title_es, title_eu, title_fr I would like to compare these 4 ...
1
vote
3answers
73 views

Custom ordering in Rails query

I have a Post model with some has_many associations. class Post < ActiveRecord::Base ... has_many :votes has_many :comments has_many :ratings end I want a query that orders the posts by ...
0
votes
1answer
50 views

Is there a PostgreSQL setting that I can use to do case-insensitive queries on column values?

I have been using MySQL for 9 years and now have a new Rails 3.2 application in which I am using PostgreSQL. I am getting bitten by a couple of assumptions that I am bringing to the project. With ...
1
vote
2answers
55 views

Query and sort by model's belongs_to relationship

I have a model Book which has many copies. Copy belongs to Book and also belongs to School, which has many copies. I would like to query for books that associate with a school and sort by number of ...
-1
votes
1answer
61 views

PG CONNECTION TIME OUT ERROR

I am frequently getting Pg Connection timeout error in my application. I tried to fix it by upgrading the system memory, also updated the pg gem but the issue is still occurring. Anybody's help will ...
1
vote
1answer
79 views

heroku pgbackups - how does it work?

I'm trying to migrate a database over to a new app from an existing one using pgbackups, but I'm running into issues. I've read the documentation on heroku's dev site but I'm still getting errors. ...

1 2 3 4 5 13
15 30 50 per page