Tagged Questions
0
votes
0answers
6 views
rails s error libpq.so.5: wrong ELF class: ELFCLASS64
I am getting the subject error.
It seems the error has something to do with the postgres libraries not being 64 bit, but other than that I can't figure it out. Bundle install runs alright, but when I ...
0
votes
2answers
33 views
Collaborating On Local Machines with Rails/Postgres
I'm working on a project with two other remote coders. I'm setting up most of the models/DBs. We're going to be working off of github, so I'll post my basic backend infrastructure, then they'll add ...
0
votes
2answers
31 views
Rails fails creating migration with NOW() default value to postgres
Common way I use it is
psql > ALTER TABLE transactions ALTER COLUMN date SET DEFAULT CURRENT_TIMESTAMP\g
it works fine.
In my RoR app I've tried to create migrations in two ways.
Tried to ways
...
0
votes
1answer
19 views
Postgres Copy from Variable with CSV data
I know you can run a copy command like this from a file:
"COPY zip_codes FROM '/path/to/csv/ZIP_CODES.txt' DELIMITER ',' CSV;"
I'd like to copy csv data from a ruby variable so I can do like so
...
0
votes
2answers
41 views
A better database model for holding postage prices
I wanted to create a Postage_costs table to hold postages costs, each postage_cost has a name, e.g Large Item, which has different costs(standard price and express postage price) depending on ...
0
votes
1answer
30 views
Rails Postgres should I add foreign key indexes
If I have the following line in a migration, will postgresql add an implicit index? Should I explicitly add an index for the foreign key? The models contain has_many and belongs_to as appropriate.
...
0
votes
3answers
30 views
Postgres - Randomize results once per day
I'm building a store and would like to randomize a product page, but only change it once per day.
I know that a randomizer with a seed number can return consistent results, so perhaps using the ...
0
votes
1answer
22 views
Postgres Bulk Data Import and Populate Associated Data
I have a Postgres database that gets updated from various external sources several times a day, and each record has fields like company_id and user_id that need to get looked up from an existing table ...
1
vote
1answer
40 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]]
=> ...
0
votes
2answers
32 views
Rails can't see my Postgres database
I'm trying to load a Rails 3.2 project on my Macbook and I'm having difficulty. I installed Postgres 9.1.4 via brew. After putting /usr/local/bin in the front of my $PATH, I can now get into Postgres ...
0
votes
4answers
27 views
What is the easiest way to query for a date in a range using Rails 4 and postgres?
I'm trying to select all records with a created_by attribute in a date range:
@start = params[:start].to_datetime
@end = params[:end].to_datetime
@registrations = Registration.where("created_at >= ...
2
votes
1answer
43 views
Rails first_or_create adds (1=2) to query
While running development code through Heroku console in sandbox mode, I use first_or_create to test for existence of a record:
Right.where(:language => language ).
...
2
votes
1answer
43 views
How to switch my Rails app to postgresql from Sqlite3?
So I started working on a Rails app recently and we decided (well not me, the person working on it with me) that we should switch from Sqlite3 to Postgresql. I've installed Postgresql on our server ...
0
votes
1answer
18 views
Rails : Create a drop table cascade migration
How do I force a DROP TABLE CASCADE in a Rails 3.2 migration?
Is there an option to pass to drop_table("table_name")?
0
votes
0answers
17 views
Rails jquery datetime into PG [closed]
I'm using jquery (coffeescript) to update a record. When that happens I would like today's datetime to go into this field:
t.datetime "completed_at"
This is the coffeescript:
compdate = ...