Tagged Questions
0
votes
1answer
13 views
psql:psit.sql: invalid command \N while restore sql
Hi all am trying to restore my dump file it cause some error like this
psql:psit.sql:27485: invalid command \N
is there any solution i searched every where i didn't get any clear answer
1
vote
1answer
25 views
Get all the rows raleted with a specific string
I am using rails with a postgresql db, and I would like to know which is the best solution, in getting all the rows which are similar with a string.
string format: domain.com or domain.com/uk or ...
0
votes
1answer
13 views
Too many database connections created in rails 2.3.18 application
We have many models like the below one.
class User < ActiveRecord::Base
create_connection
def create_connection
# we have used this ...
0
votes
0answers
16 views
digital ocean(ubuntu) - how many rails apps can be hosted in a 512mb plan (including others like nginx, postgres etc)
I am setting up some rails apps on digital ocean basic plan of 5$ per month offering 512mb memory. I just installed basic things like git, vim, nginx, postgres(along with contrib), rvm and now just ...
0
votes
0answers
32 views
Heroku keeps telling me my application fails
So I am trying to push my site to heroku for the first time and some things have gone wrong. First was the postgres DB stuff so I added the gem for pg in the production group but it continues to say ...
0
votes
1answer
11 views
Rails update one column on multiple records from one form
I have a form that looks like this:
<%= form_tag site_update_admin_settings_path, :method => :put do %>
<fieldset>
<legend>
<h2>Default Meta ...
1
vote
2answers
30 views
RoR - Failed to installing pg on rails app
I'm trying to push a project to heroku....
I'm at the step where it say's: rails new myapp --database=postgresql
After I created the command: rails new heroku:
Gem::Installer::ExtensionBuildError: ...
0
votes
0answers
19 views
Deploying to Heroku issues Rails 3.2
So i had an app that i initially developed in SQLITE and converted over to POSTGRESQL and it works fine locally. When I try to deploy to Heroku my web dynos crash when I try to visit my application. ...
0
votes
1answer
37 views
Postgres pg_hba.conf
There is server being set-up for one of my client, after installations of postgres when we run
the server we are encountering the error below. When I goggled for it there were a few solutions ...
1
vote
2answers
34 views
Rails: Purchases vs Orders
I have an eccomerce app. I have buyers & sellers (same table). A buyer has_many :purchases & a seller has_many :orders, right? But what about guest buyers (not signed in)? Should I merge ...
0
votes
1answer
16 views
can't connect to postgres after restarting mac PG::ConnectionBad
It's been a long time since I restarted my mac, and now that I have restarted it, my rails apps will no longer connect to postgres.
PG::ConnectionBad
The problem is, i can't remember how i installed ...
0
votes
2answers
24 views
rails - does postgres or rails automatically validate that a datetime column can only have datetime object?
I have a rails 4 form in which a user inputs a string that represents a datetime:
<%= f.text_field :time_frame, class: "calender_pop" %><br />
No where in my code am I converting the ...
0
votes
1answer
20 views
PostgreSQL FATAL: role “<USERNAME>” does not exist
When I bundle exec rake RAILS_ENV=production db:migrate, I get:
rake aborted!
FATAL: role "<USERNAME>" does not exist
Note that
$ psql --username=<USERNAME> ...
1
vote
0answers
15 views
Populating rails Database from Amazon RDS data
I currently am working on an inventory application(rails 4.0 on Heroku using PostgreSQL). I also have a database that tracks my sales on Amazon RDS using Sql Server 2008. I'd like to figure out a way ...
0
votes
1answer
22 views
Rails table indexes are not foreign keys in database as expected - why?
I have created tables for user and attendance (Users, Attendances) and all is good. A user has many attendances and an attendance belongs to user. The code works and Rails works but there is one big ...
0
votes
2answers
30 views
Grouping by month in database and not with ruby
I'm trying to group calls by month but I need to do it in the database and not with ruby. Here is the current code:
Call.limit(1000).group_by { |t| t.created_at.month }
Which returns:
SELECT ...
0
votes
2answers
22 views
PG::UndefinedTable: ERROR: relation «productsrules» does not exist
I'm having this issue with one of my PG DB table. I have a table, whose name is "hproducts_rules". This is supposed to have a "belongs_to" relation with the "hproducts_matchs" table.
This is my ...
0
votes
0answers
17 views
hstore on Heroku: can't iterate over hash members
I have an hstore attribute called properties. The following code puts a line break between each attribute before outputting it to the view.
def item_properties_to_string(item)
return nil unless ...
0
votes
0answers
26 views
Rails 4 polymorphic, self-join or ancestry?
I've got a Venue structure to create where you are able to place different types of components under different locations in the same Venue so the structures are like this:
Main Hall -> Conference ...
0
votes
2answers
35 views
Select distinct including a value from a different model/table
I have 2 models/tables:
class CollectionPoint < ActiveRecord::Base
belongs_to :collection_type
...
class CollectionType < ActiveRecord::Base
has_many :collection_points
...
Every ...
2
votes
2answers
58 views
+250
Rails 4 ActiveRecord throws PG::UnableToSend on Ubuntu 13.04
We have a Ruby v.2.0.0-p247 on Rails v4.0.1 application using pg gem v0.17.0.
The application runs smoothly under Mac OS X Mavericks v10.9 with PostgreSQL Server v9.2.4 installed using HomeBrew but ...
1
vote
1answer
9 views
Array for OR clause production Datatype Mismatch error
I have the following query
friends_ids = [1,2,3]
Friend.where("user_id = ? or friend_id = ?", friends_ids, friends_ids)
However, when I run it I get
PG::DatatypeMismatch: ERROR: argument of OR ...
0
votes
1answer
26 views
Whenever I run some kind of database operation (IE update_attributes, save etc.), timestamps are in UTC
When I run:
psql great_dev -c 'show timezone'
The following is returned:
TimeZone
------------
US/Eastern
(1 row)
I want the timezone to be EST, so I think that is correct. The problem is ...
0
votes
0answers
20 views
Data distribution for a system with SOA
I have a rails application which manages different types of items and users who own them. Items of different types might have different features. There is a number of sinatra services which have to ...
0
votes
0answers
47 views
postgresql gem with ruby 2.0.0-p353 on mac wont suceed
I'm trying to bundle a new rails app using Postgres.
I get this error each time I try to bundle.
Errno::EACCES: Permission denied - /usr/local/var/rbenv/versions/2.0.0- ...
1
vote
1answer
31 views
Using interval in PostgreSQL with Ruby on Rails
I want to save durations (2 days, 5 years, ...) as intervals in PostgreSQL from my Rails application.
Both duration_min and duration_max are values like "2 days" or "5 years", so each of them is an ...
0
votes
1answer
35 views
Rails migration generate
How would one manage if there were a lot of migrations file made using rails g migration?
For example if I had a file that generate a column for a certain table, I had this but again later down the ...
0
votes
1answer
23 views
How do you define postgres functions in Rails and what is their scope and lifetime?
I know nothing about Postgres functions however the need to use them has come up a couple of times recently (this may be indicative that I'm approaching the problem incorrectly but regardless...)
I ...
0
votes
1answer
29 views
How can I set the time in postgres in order to test timezone behaviour using RSpec?
I want to be able to test the behaviour of a scheduler component across different timezones. However, the functionality to trigger scheduled behaviour uses time based queries within postgres:
e.g.
# ...
0
votes
0answers
50 views
Rails select NoMethodError in Messages#new
I'm trying to put on a select box the Users who will receive the message.
What we have is one table named Messages, one named Users and one named Friendships, on message table we have user_id (sender) ...
0
votes
1answer
28 views
Rails - Issue when running bundle install - Installing pg (0.17.0)
When running 'bundle install' I get the following error message.
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
...
0
votes
1answer
23 views
ox -v 2.0.11 Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
Mac OSX Mountain Lion, Rails 4.0.0, Ruby 1.9.3, Postgresql
I am working on a project with one of my friends and when I cloned into his master code (using "git clone") and tried running "bundle ...
0
votes
2answers
31 views
Plucking from an Associated Model
I have two models, User and Post. Post belongs to User. User has a field titled name. I want to pluck the names of users. I was thinking of doing something like this.
some_cool_posts = Post.limit(5)
...
0
votes
2answers
65 views
Rails 4.0.1 on Heroku, can't create database
I can't get rake db:migrate to run on my rails 4.0.1 app on Heroku.
I'm guessing that I don't have postgres configured properly... but reading the docs on heroku hasn't really helped and I'm not sure ...
2
votes
1answer
30 views
Added data to postgres in rails 4.0 console not visible in pgAdmin
I am following this rather good rails tutorial as an introduction to the world of ruby on rails.
I have configured my sample app to use postgresql in line with the Heroku site where it is ...
1
vote
1answer
31 views
Check if any of a given array of values are present in a Postgres array
I'm writing a Rails 4 app and have a string array column on one of my models called identifiers. When the user passes in a list of identifiers, what's the syntax to fetch the rows where any of the ...
1
vote
4answers
50 views
Different database for testing and development
I have seen many examples where sqlite is used for the testing database and postgres/mysql for development.
What are the implications of this strategy?
There are obvious differences between the two ...
0
votes
1answer
46 views
Ruby on Rails : Development vs Production database - where to enter data?
I'm very new to Rails.
I am confused about the development and production databases. I am using postgreSQL for all of my environments and heroku to host the site. I am able to push migrations and ...
1
vote
2answers
77 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
28 views
Rails handle multiple Params in search query
I have the following model and I want to pass multiple params in "with_query", don't know how to achieve it. currently you can see it takes only "query" param. how can I filter it with country and ...
0
votes
1answer
38 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
73 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
2answers
25 views
Postgress error- bundle install
When I run $bundle install I am running the project on heroku so I had to switch to postgress. I keep getting this error for some reason. An error occurred while installing pg (0.15.1), and Bundler ...
0
votes
4answers
32 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
1answer
38 views
sqlite vs postgreql in rails
Quick questions, haven't been able to find concrete answers about this questions. I'm guessing it's because the answer is obvious.
I know that in order to push a rails app to Heroku a postgreql ...
0
votes
1answer
18 views
Capistrano, Rails, PostgreSQL Master-slaves replications making it hard to add additional tables to slaves
I have build a document-management system which consist of a content-management Rails application (for writing and managing docs, users and other content) and an End-User Rails application (for ...
0
votes
1answer
25 views
How to describe a column programmatically in select part of request in Rails?
There is the following scope:
scope :by_radius, ->(lat, lng, rad) { select("*, (6371 * acos(cos(radians(#{lat})) * cos(radians(latitude)) * cos(radians(longitude) - radians(#{lng})) + ...
0
votes
2answers
139 views
Cannot install pg gem in Mavericks with Postgres.app
I am trying to install the pg gem for use with Postgres.app on my local machine. I am running Mavericks.
Postgres.app is installed and running fine, but I cannot get the gem to work. I've done the ...
0
votes
2answers
32 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
1answer
22 views
postgresql full text search rails title and description
I am trying to search a model with title and description, but having the following error. I want to be able to search title and description and the type of job. Any help will be really appreciated.
...