1
vote
2answers
40 views

Ruby on rails - wrong number of arguments (2 for 1) [Rails]

I've just change my database from sqlite3 to postgresql in my Ruby on rails. Every things worked before but now I have a "wrong number of arguments (2 for 1)" when I submit the form. I don't ...
0
votes
1answer
30 views

Rails lost migration file issue

2 months ago, one of my migration files has been removed. The thing is when I rake db:migrate my database in localhost the migration is missing. I can Not create a new migration because the production ...
1
vote
5answers
62 views

<% if current_user.id == @status.user_id %> when user not signed in

Currently, I have in my 'show' view for a question model <% if current_user.id == @question.user_id %> <%= link_to 'Edit', edit_question_path(@question) %> <% else ...
0
votes
4answers
27 views

getting a random product in rails

/products/index.html.erb <div class="hide-for-small panel"> <h3>Sidebar</h3> <h5 class="subheader">Feature Product</h5> <% Product.random do | product | %> ...
0
votes
2answers
27 views

Ruby on rails : Data base sqlite3 to PostgreSQL [RALS]

I'm converting my data base from sqlite3 to PostgreSQL in my rails project, so I follow this tutorial : https://devcenter.heroku.com/articles/sqlite3 I suceed to make all the needed changes but at ...
0
votes
2answers
31 views

Postgresql with Rails 4.0.1 — not running on localhost:3000 or deploying to Heroku

When I try to run my sample Rails 4.0.1 app on my localhost:3000, I get this error: PG:: ConnectionsBad FATAL: role "myapp" does not exist. I'm running on Maverick OSX and using Ruby 2.0. I created ...
1
vote
2answers
34 views

Active Record object based on group by count

Hi I am ROR developer and using rails 3.2.13 with Postgres database. I have two models: Question attr_accessible :category, :is_active, :question_text, :question_type_id, :survey_id, ...
3
votes
1answer
24 views

Trying to set prices to extended decimal/BTC in Rails on Heroku

So I'm relatively new to Rails, but have been trying to build a little store to sell some things for bitcoin. When I run my storefront on my local environment my pricing looks great (i.e. a book for ...
-1
votes
0answers
27 views

Reverse engineering radio buttons with multiple options and its sub-values

I need to reverse engineer below field in Rails. I've tried various methods like saving into another string column then reference this from types table with belongs_to relationship. This doesn't seem ...
1
vote
1answer
21 views

Restore PG local database from SQLite DB - Rails

I just switched my whole app's (dev and test) databases to Postgres and got it working well. I did have a ton of information (users, posts, etc) on my local sqlite database that I would love to ...
0
votes
1answer
72 views

Rails 4 Hstore, array escaped quotes

I'm trying to store a Hash of arrays using Rails 4 and Hstore (Postgres 9.2) for when users submit a form with a bunch of checkboxes. The problem I'm having is that once they're stored, all the ...
0
votes
1answer
30 views

How to Conditionally Rollback a Transaction Using the PG Ruby Gem

I am currently taking a databases course and one of the lab questions has me stumped as to how to implement the above and indeed, if it was even possible. I have tried searching the docs but the ...
1
vote
1answer
22 views

How can I avoid duplication in a join query using Sequel with Postgres on Sinatra?

I want to do a simple join. I have two tables: "candidates" and "notes". Not all candidates have notes written about them, some candidates have more than one note written about them. The linking ...
0
votes
0answers
31 views

gem install dm-postgres-adapter build error

i'm trying to build dm-postgres-adapter but get this error. sudo gem install dm-postgres-adapter Building native extensions. This could take a while... ERROR: Error installing dm-postgres-adapter: ...
0
votes
1answer
48 views

Rake db:migrate and db:create not operated with proper database files

I know this question has come up on stackoverflow before, and I have tried the various solutions suggested, even trying to restart my current app. But none of them worked. I am trying to change my ...
0
votes
1answer
16 views

Connection Not Established Ruby Postgres

I am getting this error. ActiveRecord::ConnectionNotEstablished /Users/jod/.rvm/gems/ruby-1.9.3-p194@BankingApp/gems/activerecord- ...
0
votes
1answer
29 views

Postgres/Rails => is object guaranteed to be persisted if I do .save?

If I have a model and save it like this: model = Website.new model.attr = 1 model.id = 1 model.save #assume no errors in saving then retrieve it like this: model2 = Website.find(1) Will model2 ...
0
votes
1answer
57 views

Adding or Subtracting Time From Postgres Timestamps

I am using the following ruby code, with the PG gem, to return a timestamp that is in Postgres "timestamp without timezone" format. Instead of returning the current value, I would like it to return ...
0
votes
0answers
26 views

Rails 3.2.13 - Heroku Error Code H10, after importing Postgres database from development environment

I created a Rails 3.2.13 app in the development environment, and as I pushed to Heroku to the production environment I got an error. I transferred my local development PostgreSQL database over to the ...
1
vote
1answer
47 views

DBI::OperationalError: could not connect to server: Connection refused

On rails console when I tried to connect to postgres database which on machine having ip address suppose xxx.xxx.xxx.xxx. Gem installed gem 'dbi' sudo apt-get install libpq-dev gem 'dbd-pg' I ...
1
vote
1answer
33 views

Questions about Rails-Postgres Database connections

We have recently been having issues with postgres running out of connection slots, and after a lot of debugging and shrugging of shoulders we have pretty much tracked it down to the fact that we ...
2
votes
2answers
67 views

Rails validating values in array

In my Schedule model I want to add some validation to the :wdays field, which is an int[]. I only want values 0..6 to be valid Valid Schedule.wdays = [0,1,6] Invalid Schedule.wdays = [0,1,10] I ...
0
votes
2answers
38 views

Removing Column Names From PG Gem Return Values

I am trying to retrieve a list of URLs from my Postgres DB, using the following method... def get_urls(site_id) conn = PGconn.open(:dbname => 'my_listings') res = conn.exec("SELECT url_list ...
0
votes
2answers
26 views

psql could not connect

I am currently working on a ruby on rails application and I am having problems running a RSpec test. With further drilling , i went into my terminal and tried to run the simple psql command psql ...
1
vote
1answer
322 views

bundle install errors at pg (0.16.0) on OS X 10.9

I am trying to install metasploit on OS X 10.9. Everything i run bundle install, at the installing pg (0.16.0) it errors out ...
0
votes
2answers
88 views

Heroku doesn't create postgres database tables (and database itself) for rails 3.2

I have been trying to deploy my Rails applicaton to Heroku. It uses paperclip and SQLite at my computer and I am trying to use SQLite at my computer and PostgreSQL at Heroku. Here is my Gemfile: ...
0
votes
2answers
47 views

Read Lock in Ruby on Rails

There doesn't seem to be a built-in way to acquire a read lock in Rails (for a table). I know these are not typically ideal, but my use case seems to require one: There are a limited number of ...
1
vote
4answers
77 views

Store the day of the week and time?

I have a two-part question about storing days of the week and time in a database. I'm using Rails 4.0, Ruby 2.0.0, and Postgres. I have certain events, and those events have a schedule. For the event ...
0
votes
3answers
69 views

Sorting broken when moving to Postgresql

I'm deploying my application to heroku (and like a n00b) during my development I was using SQLite3. I deployed to Heroku and i'm getting errors for specific pages. I loaded up Postgresql as my ...
-1
votes
1answer
54 views

Why is the 'where' method making an unnecessary database call?

I am running Rails 3.2.10 on Ruby 1.9.3, use PostgreSQL as the db and RubyMine to debug my code. While debugging, I noticed that, this line: @monkeys = Monkey.where(user_id: 2) Makes 2 database ...
0
votes
0answers
42 views

Flickering Tests with PhantomJS and Rspec

I am using PhantomJS in my Rails app for integration testing of a form that is submitted through AJAX. My test suite runs green the first few times, and then eventually I run into these errors, which ...
0
votes
1answer
217 views

PG::ConnectionBad - could not connect to server: Connection refused

Everytime I run my rails 4.0 server, I get this output. Started GET "/" for 127.0.0.1 at 2013-11-06 23:56:36 -0500 PG::ConnectionBad - could not connect to server: Connection refused Is the server ...
0
votes
2answers
37 views

Seeding with a has_many relationship

Im trying to seed my db with recipes that has a has_many relationship with ingredients. The ingredient table has 4 rows. I keep running into errors with my code however. Here's my code. I'm fairly new ...
0
votes
1answer
77 views

why there is difference between psql -version output and the psql version connected to my application?

I am building up a rails application that I cloned from my friend. I am using Ubuntu 13.10, rails 3.2.14. I am using a postgresql database and when I try to run rake db:migrate it gives me some error ...
0
votes
1answer
36 views

Unable to insert data including a timestamp with the PG gem?

I am using the PG gem to insert data into my Postgres database, however, when I try to insert data including a timestamp, the database does not get updated. Here is the code I ran from IRB: :001 ...
1
vote
1answer
68 views

Find diseases from users suffering for a specific disease

EDITED: I trying to get all other DISEASES from users suffering for disease A. OLD QUESTION (WRONG): I trying to get users suffering from some disease also suffer for other diseases: class User ...
0
votes
1answer
49 views

How to find and replace data in a column via Rails migration

I have a column called "meta" in a table called "Notifications". The data in the column looks something like this: --- :full_name: Dude :user_id: 1 :update_id: 10 :update_type: want :update_name: ...
0
votes
2answers
34 views

RVM install giving postgres error (rails)

I get a postgres error when I'm trying to install rvm for some odd reason. $ sudo apt-get install ruby-rvm Error: Reading package lists... Done Building dependency tree Reading state ...
0
votes
1answer
33 views

What are different steps to optimize the postgres database and queries?

I am optimizing Postgres with Ruby on Rails . For last few days I am finding that my site is loading slowly. Application is using different queries with join of 3- 4 tables to fetch the data . ...
0
votes
0answers
61 views

Ruby on Rails: How do I use Chef to provide the database parameters?

One of my Ruby on Rails apps is Bargain Stock Funds (https://github.com/jhsu802701/bsf), and it relies on a Ruby gem called bsf_scrape (https://github.com/jhsu802701/bsf_scrape) to obtain and process ...
0
votes
1answer
55 views

postgres encoding error in sidekiq app

I am working on an application where a ruby sidekiq process calls a 3rd party and parses the data into a database. I am using sequel ad my orm. I am getting some weird characters back in the ...
2
votes
2answers
56 views

Wrong order on has_many association when upgrading from rails 3 to rails 4

I am trying to update one project from Rails 3 to Rails 4. In Rails 3 I was doing: class Sale < ActiveRecord::Base has_many :windows, :dependent => :destroy has_many :tint_codes, :through ...
1
vote
0answers
54 views

failing migrations : PG::ProtocolViolation Rails

I just updated to rails4 and realized that my db roles and database was somehow not setup. So I dropped the db and re-created the app_development db and the roles. Now I am trying to run rake ...
0
votes
2answers
38 views

Postgresql lock shared table with multiple users

So, I'm having a synchronization issue here; Let's explain the situation: I have a table called Sendings, that consists of these columns: id sending_object_id type destinatary The id is the ...
0
votes
1answer
34 views

PG:ConnectBad Rails 4 Postgresql

I know it seems like this question has been asked a hundred times but this time I think it is different. When I restart my mac and run rails s, the site works fine. ➜ BankingApp git:(master) ✗ ...
0
votes
1answer
33 views

Database scheme for tree comments

What is the best way to implement tree comments (each comment can have comments, those comments can have comments too). It should be up to 10 levels of comments. I'm using Rails with PostgreSQL ...
0
votes
1answer
22 views

Migrate to Devise in Ruby on Rails

I have an existing model that uses bcrypt to encrypt the user password. I wonder how I could migrate to use devise? Do I still install devise the normal way and change the model attribute via database ...
0
votes
2answers
95 views

Undefined error with db:migrates when deploying with capistrano

When I try cap deploy:cold, everything is ok, but on this stage: ** transaction: commit * 2013-10-25 18:36:38 executing `deploy:migrate' * executing "cd ...
4
votes
4answers
3k views

Repairing postgresql after upgrade to OSX Mavericks

A recent upgrade to OSX Mavericks has broken my database connection for my Rails app. When I try to fetch from the database the server returns the following error: PG::ConnectionBad (could not ...
0
votes
1answer
46 views

Insert records to Heroku database

How can I insert new records to Heroku database. I have successfully uploaded my application and database structure. Now I need to insert some records so it could work. I tried to use seeds.rb but ...

15 30 50 per page