Tagged Questions
1
vote
0answers
15 views
Best Practices - RoR 4 Heroku - Cron to fill database each hour from external API
I have to call externals API to fill my database, hosted on Heroku each hours.
For this purpose, I've a ruby script that get all the data from externals API and output on the stdout. Now, I would ...
0
votes
1answer
23 views
How to do this group ActiveRecord query in postgres
I try to find over a 3M table, all the users who have the same username. I read something like this may do the trick.
User.find(:all, :group => [:username], :having => "count(*) > 1" )
...
0
votes
0answers
26 views
Cucumber and RSpec testing with zeus: Postgres is being accessed by other users
In my Rails 3.2.13 app, I'm using Zeus. In the test environment I use PostgreSQL. When I run Cucumber and then RSpec (or the other way around), 9 out of 10 times I get the message:
PG::Error: ERROR: ...
0
votes
0answers
48 views
Rails: How to select a limited amount of rows for each foreign key?
Here's how it's done using pure SQL but is it possible to do this in Rails w/ Postgres? How to select a limited amount of rows for each foreign key?
0
votes
0answers
28 views
Count active users over time (ROR)
I have the following model and attributes:
class Student < ActiveRecord::Base
attr_accessible :name, :active, :date_of_withdrawal, timestamps
#:active = boolean
Im trying to count the ...
0
votes
0answers
40 views
Setting connection parameters postgresql in ruby
When I run my rails server, and load up my localhost:3000 page, I get an error saying that I haven't supplied the database password.
I'm using the better errors gem, so it shows me to go to my ...
0
votes
2answers
20 views
How can i do a select from foren table using active record
I have 2 tables, Accounts and Subscriptions. All the accounts have a subscription and when i do
Account.last.subscription.name
Account Load (0.4ms) SELECT "accounts".* FROM "accounts" ORDER BY ...
0
votes
0answers
15 views
Is it possible to write a Rails SQL call to find the ordered sum of children of children?
Brain < has_many > QuestionGroup < has_many > Questions < belongs_to > Weakness
Is there an elegant way to order Question Groups by which has the most Weaknesses ?
0
votes
1answer
16 views
column spree_preferences.key does not exist
When I run
rake db:migrate
I get the following error message.
PG::Error: ERROR: column spree_preferences.key does not exist`
Anyone can please tell me how to fix this error.
-2
votes
0answers
13 views
Rails Postgresql Merge into one query
I have two queries.
Task.where('name not in (?)',tags)
Task.where("actions -> '#{Date.today}' > '0'")
name is string
action is hstore Postgresql
Please, help me to merge into one query.
0
votes
3answers
44 views
Rails ArgumentError “Unknown Key”?
So I have a Rails app in which users can create 'submissions'. Now I'm trying to add the ability to create folders in which submissions will be, for organization. However, I've seem to have run into ...
0
votes
1answer
10 views
Rails - Generate email address when one doesn't exist with Omniauth integration
I am working with omniauth with Rails and trying to get twitter, facebook and google hooked up for authentication but keep running into this error:
PG::Error: ERROR: duplicate key value violates ...
0
votes
0answers
21 views
Will a product-price history table greatly affect db performance?
I have over a million products in a db. Each product's price fluctuates often. I plan on storing these price fluctuations in a "price history" table (product_id, price, validity_start_date, ...
0
votes
1answer
21 views
Setting up PostgreSQL for forked rails application
I have forked the development version of a Rails app I've started contributing to onto my laptop, and it uses PostgreSQL as it's database.
I have already installed postgresql with brew, what should I ...
0
votes
1answer
46 views
Rails create not saving permanently
I have a rails 3.2.13, postgres, ruby 1.9.3 app and am running into an issue when an object appears to be saving temporarily, and then disappears.
In my rails console, I did the following:
s = ...