Tagged Questions
1
vote
0answers
35 views
Rails: Update a column with the value of a column in another table
I have basically the following code:
ModelA.join(:modelB).update_all('modelA.column = modelB.column')
That fails with:
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: missing ...
0
votes
0answers
33 views
Radio button selection Rails - Across partials
I am trying to allow the user to pick one of the predictions out of the 7/8 (which are loaded with the predictions partial) as a double match (double points for anyone interested). I can't get it to ...
1
vote
1answer
31 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
42 views
digital ocean(ubuntu) - how many rails apps can be hosted in a 512mb plan (including others like nginx, postgres etc) [closed]
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 ...
-1
votes
0answers
46 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 ...
-1
votes
0answers
29 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. ...
1
vote
2answers
67 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 ...
1
vote
0answers
31 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 ...
1
vote
2answers
66 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
32 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
44 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
0answers
112 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- ...
0
votes
0answers
61 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) ...
1
vote
1answer
56 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.
...
1
vote
2answers
115 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
2answers
49 views
How can I update a data record's value with Ruby on Rails 4.0.1/PostgreSQL Hstore?
I'm encountering a strange issue that must be user error on my part but can't figure it out.
I'm using Ruby 1.9.3-p194, Rails 4.01, PostgreSQL.
I have a model, Customer, with a column called data ...
1
vote
1answer
31 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
0answers
9 views
Rails cache digests and multple schemas
We are looking at using the cache digest gem in our Rails 3 application. One area of concern is the fact that we are using multiple schemas. Does anyone know if we will need to add the schema/tenant ...
0
votes
2answers
57 views
postgresql rails price range filter with between
I have the following array of price ranges how can I perform a query to find the price range between these using and operator
This is the array I have
["0-1000", "5001_15000", "15001_25000"]
...
1
vote
2answers
36 views
Sunspot only can search one column in table
I can search the customer by name.
But can not search any data with phone and email.
Is there something wrong?
controller
@customer = Customer.search do |q|
ap(params[:customer_query])
...
0
votes
0answers
33 views
Error while running rails app on console
I'm landing up in some error when I try to run the application on the console, FYI this error is showing up on the client server, the error is
root@host [path]# RAILS_ENV=development ruby ...
0
votes
0answers
19 views
Order issue in rails4 with postgresql [duplicate]
has_many :posts, :class_name => "Spree::Post", :dependent => :destroy, :order => "posted_at DESC"
Getting below error always from rails4 but works with rails3
...
0
votes
0answers
30 views
postgresql upgrade to latest version
I have the postgresql-9.2
Now I am trying to upgrade postgresql to 9.3. Since it is in live server I am unable to upgrade without proper guidance
I heard about pg_upgrade to upgrade but How can i ...
0
votes
2answers
38 views
Postgres error when trying to display all items through a relationship
This works on SQLite3, but not on PostgreSQL.
The error I'm getting is PG::InvalidColumnReference: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
I'm trying to display ...
0
votes
1answer
130 views
Can't push Rails App on Heroku since OSX 10.9, gem install pg is not working
Since OSX 10.9, I'm not able any more to push my rails app zu heroku.
Heroku gives the following error:
Failed to install gems via Bundler.
Push rejected, failed to compile Ruby app
When I ...
1
vote
1answer
44 views
Group by two columns, to get uniq result
I want to group the results from one table by two column: created_at p_id, I need to group it by p_id because I need unique values, and I tried using distinct in order to do that but in my case didn't ...
0
votes
0answers
41 views
Rails how to implement hierarchical associations
Is there a Rails way to implement hierarchical associations?
I'm currently trying to map below layout fields in database:
Product -> Product URL -> No Link
-> ...
1
vote
3answers
38 views
Use index to label results in rails 4
I have generated a list of files that different users have uploaded.
2 Pen writing 83746__braffe2__pen-writing.wav audio/wav 1057836 2013-11-17 03:43:29 UTC
3 Pen writing ...
0
votes
1answer
82 views
RoR Hartl Tutorial: Section 11.1 - error when running rspec “operator does not exist”
First time posting. Been working through Hartl's RoR tutorial, and I'm stuck on an rspec test that is failing. I went over the code, and copy and pasted directly from the site instead of typing and I ...
2
votes
2answers
75 views
How to make ORM (ActiveRecord) Models for union queries in Rails
I have an application that has some basic entities
Posts
posts have:
Likes
Comments
and Ratings
I then have an SQL view to query for all three. With that I have a model called something like ...
0
votes
0answers
54 views
Postgres database has no password - can't get into pgadmin
I have a rails app using postgres. When I made the app, I never created a password. In my database.yml file, no password is listed. My application works, but I am trying to connect to the db using ...
1
vote
1answer
26 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- ...
2
votes
1answer
33 views
Select subset of elements and their children in rails
I have a collection of albums and each album has songs.
I want to filter all albums where most played songs are and inside these albums have references only to the most played songs.
Something ...
0
votes
3answers
148 views
how to set up postgres database for local rails project
I recently got a new machine and would now like to work on my projects from github. I'm curious as to how to properly set up the postgres database on my local machine. I have postgresql, pgadmin3 and ...
1
vote
1answer
48 views
Postgres insert error in ActiveRecord
For some reason, I cannot get ActiveRecord to correctly format the insert statement when using an array type column. It seems to want to escape the Postgres notation:
{"val1", "val2", "val3"} into ...
0
votes
0answers
41 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 ...
0
votes
1answer
105 views
set up postgres users, roles and databases for rails
This really has me stuck, I'm a bit of a noob trying to use postgres for rails 4
I have postgres installed:
$ psql --version
psql (PostgreSQL) 9.1.10
contains support for command-line editing
$ ...
0
votes
0answers
60 views
devise : new user registration issues , PG::ProtocolViolation . Rails4, Postgres
I am using devise and omni-auth to login with linkedin .
I added the from_omniauth method to user model as mentioned in the Railscast:
This is the code:
#Create a new user if does not exist
...
1
vote
1answer
45 views
Rails & Devise - Autologin Across Subdomains
Setup
I have a Rails application where users register for an account, and a subdomain is created for them. They can then proceed to the subdomain and log in with their credentials. The workflow ...
0
votes
1answer
36 views
How do I get the latest records depending on the foreign key
I am using rails with postgres.
I have a table called 'attempts' which belongs to a 'users' table.
I want to retrieve all attempts but only show the latest attempt for each user.
So I want code ...
0
votes
0answers
51 views
Brew install postgresql permission error
I'm following Michael Hartl's book on Ruby on Rails and I'm trying to set up a postgresql database to run locally so it matches the production database (heroku) but I got an error during the ...
0
votes
0answers
42 views
Rails dropped all of my tables unexpectedly
As far as I can tell, Rails just dropped and rebuilt all the tables in my development environment. I know what you're thinking, and I may be a klutz, but not that much of a klutz.
I was minding my ...
0
votes
1answer
62 views
Rails: rake db:create:all (could not connect to server) psql works fine
I've looked here and here but still can't solve my problem.
I have my setup working perfectly on my normal linux but when I tried to recreate it on my mac postgres won't work with rails. After ...
2
votes
1answer
42 views
pg_search using associated_against gives error “column [model_name].[associated_column_name] does not exist”
I'm trying to use pg_search to search through an associated model. When I run a search I get the error "PG::Error: ERROR: column plans.name does not exist". I'm running the search in the "plans" ...
1
vote
1answer
82 views
gem install pg works but bundle install doesn't
env ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config works but when I try to run bundle install it throws this error
Can't find the ...
0
votes
1answer
889 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
0answers
53 views
Postgres DEV en. not working, but heroku is
PG::UndefinedTable: ERROR: relation "users" does not exist
LINE 4: WHERE a.attrelid = '"users"'::regclass
^
: SELECT a.attname, ...
0
votes
1answer
113 views
Setup postgres database with Rails app on Ubuntu
Now I'm a little shaky with Ubuntu and postgres, but here is what I've currently done.
In Ubuntu, I've created a user, called postgres, with a password of postgress:
$ sudo adduser postgres
Enter ...
0
votes
0answers
35 views
how use predicate ransack and column name with database from postgresql
I'm new by using Ransack. I was trying to filter with Ransack.
In controller :
@search = query.search(params["filters"])
In model, it was like this:
user_id: [all] + u.name
Because I got ...
0
votes
0answers
25 views
Fix GroupingError or Deploy somewhere else?
A wonderful user wrote this slice of code for me.
@ribbits = Ribbit.where('user_id IN (?)', buddies_ids).order('created_at DESC').group(:user_id)
I'm running twitter Rails 3.2, and this lets me ...