0
votes
0answers
13 views
SQL group uniquely by type and by position
Given this dataset:
ID type_id Position
1 2 7
2 1 2
3 3 5
4 1 1
5 3 3
6 2 4
7 2 6
8 3 8
(There are only 3 different ...
0
votes
0answers
6 views
RoR Application built using spree works fine in local not in heroku
I have an ROR application thats about an year old so it uses older versions of multiple spree dependencies but i have ensured that it works perfectly and as expected without any dependency issues in ...
0
votes
1answer
42 views
Query works on MySQL but not in Postgres SQL
I would like to know how to write this ruby on rails query for a postgress database? It works via mysql, but on postgres it returns an error:
RUBY ON RAILS QUERY
response_array = Vote.
...
0
votes
1answer
25 views
Rails 4 / Ruby2 / PG9.3: ActiveRecord confuses tables on SQL subselect
In my rails app projects are assigned to users via assignments. Now I want to retrieve the unassigned projects for a specific user. The SQL query:
SELECT * FROM projects WHERE id NOT IN (SELECT ...
1
vote
2answers
24 views
How to select from a table that has been joined with same model/class/table?
I'm trying to get a count of how many subcontacts every contact has.
Class Contacts
has_many :subcontacts, class_name: "Contact",foreign_key: "supercontact_id"
belongs_to :supercontact, ...
1
vote
1answer
18 views
Can't run Ruby on Rails tests on Heroku's hosted Postgres databases
I'm currently evaluating Nitrous.io and liking what I'm seeing so far. I've currently got a few databases for testing and development running on Heroku's hosted Postgresql service as well. I'm running ...
0
votes
0answers
11 views
Extracting API into another heroku app. Best practice
I'm planning on extracting some API endpoints from a Rails app hosted on Heroku that uses Postgres into a new Heroku app. What is the advisable way to do this?
Share the database with the 2nd app ...
1
vote
0answers
14 views
how to set rails validates uniqueness on column hstore key?
I have a table channels, with an hstore column credentials. The credentials for each channel might be different, but I want them to be unique when populated. I have set some postgres indexes like ...
0
votes
1answer
19 views
PostgreSQL - group by clause or be used in an aggregate function (error)
I'm following this rails cast video:
http://railscasts.com/episodes/382-tagging.
On Tagging with my Rails 3.2 app on Postgres.
Everything works perfect except for the tag cloud functionality. For ...
1
vote
1answer
18 views
Rails pending migration in rake db:test:prepare
I've run rake db:migrate and all of my migrations ran. However, when I try to run rake db:test:prepare I get the error:
You have 1 pending migrations:
20130724211328 CreateGalleries
Run `rake ...
0
votes
1answer
26 views
Postgres on Rails FATAL: database does not exist
I've reinstalled Postgres (9.2.4) and I'm having trouble getting it set back up with Rails 3.2.11. I did:
brew install postgresql
initdb /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres -l ...
0
votes
0answers
14 views
Speeding up queries in pg_search that use associations
I have a Rails app that uses the pg_search gem to leverage the Full Text Search capabilities of PostgreSQL.
In the manual it says, about searching a model that has (for instance) a has_many relation:
...
0
votes
1answer
31 views
Rails unable to reset development database
I tried to drop and reset my database in development with: rake db:drop db:create db:migrate and it didn't work for some reason. Now when I try to run that command I get:
FATAL: database ...
0
votes
1answer
52 views
RuntimeError: ERROR Mrelation “tablename” does not exist
Rails - 2.3.8
Database - Postgres(9.2)
Active record query is not able to generate tablename in double quotes ie
# this ran fine
Table.find_by_sql('Select * from "Table" Limit 1')
...
1
vote
0answers
21 views
rails server stopped working suddenly could not connect to server [duplicate]
Here is the error I am getting. It just stopped working suddenly
=> Ctrl-C to shutdown server
Exiting
/Users/JenniferAllen/.rvm/gems/ruby-1.9.3-p392@credoppl/gems/activerecord- ...