0
votes
0answers
2 views

How to authenticate users using rubycas-server in rails?

I'm using rubycas-server GEM as my CAS server. This CAS server is checking user credentials from a user table of a different database. These users are created using Devise gem. Devise saves every ...
-2
votes
0answers
22 views

PG::ConnectionBad: could not connect to server: No such file or directory

I am trying to get postgres to work on rails but I cant see to do so. It is quite frustrating. rake aborted! PG::ConnectionBad: could not connect to server: No such file or directory Is the ...
1
vote
1answer
15 views

Database models and migrations explanation

I would like to confirm that I understand how database models and migrations work from someone who knows this subject better than myself. Model: How the database is structured and how the data is ...
2
votes
3answers
13 views

How to return matched results in ActiveRecord and then remainder?

Say we have data like < id: 1, name: "Bill", type: "Lemur" > < id: 2, name: "Bob", type: "Cow" > < id: 3, name: "Nancy", type: "Lemur" > < id: 4, name: "Jack", type: "Seagull" ...
-1
votes
0answers
24 views

Manipulate records in instance variable but not in Database

Ok what i am tring to do is do a where on the database and return multiple records @notifiers = Notification.where(:ref_id => params[:id]) but this gets the records as it is in the database... ...
1
vote
3answers
32 views

Rails change column type and update column values

I have a table called Users with a column Active that is type boolean. I will soon need to change the type of that column to string. I will also need to change all of the column values of Active ...
0
votes
1answer
19 views

Sorting on last record of a has many relationship table rails and retaining main table values

I have a tickets table which has_many ticket_messages. I need to sort on the created at of the last ticket_message. I did that using: Ticket.joins(:ticket_messages).where('ticket_messages.created_at ...
1
vote
1answer
32 views

An error occurred while installing pg (0.15.1), and Bundler cannot continue

I am fairly new to ruby and while going through the railstutorial.org, I ran into an issue. When I attempt to bundle install my ruby application with 'bundle install --without production', I get: ...
0
votes
0answers
14 views

dokku-alt postgres superuser

I am trying to use dokku-alt (https://github.com/dokku-alt/dokku-alt) to provision a VPS for a Rails App (Ruby 2.1.3, Rails 4.1.2), but my app uses a Postgres extension (pg_trgm). Unfortunately ...
0
votes
0answers
27 views

Select multiple options from HAML Dropdown list in Rails for Active Record Association

I have 3 models in my Rails application class Project < ActiveRecord::Base has_many :genreizations has_many :genres, through: :genreizations end class Genre < ActiveRecord::Base has_many ...
0
votes
0answers
12 views

Adding gin index to postgresql array doesn't affect loadtime

My RoR app has a Vendor class which has a related_software and description attribute. related_software is stored into the postgresql database as an array. I'm using the pg gem for searching the ...
0
votes
1answer
17 views

Is there a guarantee that ActiveRecord returns objects ordered by ID?

My project is hosted on Heroku. I was surprised when Room.all method returned objects with first object with ID 2 and only then a second object with ID 1. I thought that there were some sort of ...
0
votes
2answers
27 views
+100

Saving headings, subheadings, paragraphs and table data in a database

I am planning to have views that include a lot of user contributed text in the form of headings, subheadings, paragraphs and table data. Right now I have separate models for headings, subheadings and ...
0
votes
1answer
19 views

Rails Active Record multiple associations

I have a Rails app using Postgres and Active Record, and can't fathom the most efficient Associations between my models. I have a Model called Article. Article needs to have a Format and 2/3 Genres. ...
1
vote
0answers
30 views

Postgres: ERROR: value too long for type character varying(255) Does not specify the field

I am getting this error occasionally and obviously I need to change the type from string to text, but the logs do not show which column is the culprit. Below is log from resque which is the most ...
0
votes
1answer
11 views

Pushing Data from Local Rails App up to Elastic Beanstalk

I have a working rails app on my local mac osx environment working with a local postgres database. I have managed to get a sample app up and working on EBS using puma and mysql. I get that pushing ...
0
votes
2answers
31 views

Error during installation of both PG and Bundle

I'm in the final lesson of my first RoR tutorial and I'm being directed to open up terminal and input install bundle The result: tonys-mbp:crumblr Tony-MBP$ bundle install Fetching gem ...
0
votes
2answers
22 views

In ActiveRecord is there a way to cache `.all` so that it can be used by `.find_by`?

I have a loop that goes through and updates my records based on remote records. So I end up selecting some subset of 19 objects by a two char string key called symbol. What I would like to do is ...
0
votes
1answer
21 views

PostgreSQL ilike with multiple matches in Rails ActiveRecord

I am trying to retrieve multiple records from my DB with the following query: User.where('name ilike ?','%thomas%') this works fine. Now I want to retrieve multiple records at the same time and ...
2
votes
1answer
27 views

Group by and order by has many through model in Rails

Hi I've searched but have not found the way to do this I have the following models: class Hierarchy < ActiveRecord::Base belongs_to :user belongs_to :family end . class Family < ...
-1
votes
0answers
23 views

I Cannot Access PostgreSQL After Updating Server App [closed]

I am running the latest version of Mavericks 10.9.5 on my Mac Mini Server. Before the upgrade to the latest version of the Server App 3.2.1 I was able to access PostgreSQL in my Ruby on Rails ...
0
votes
1answer
26 views

Group by users throws error

I have a model Reminder with the fields: :text, :name, :user_id As you can see i refernce to the user. Now i tried to make a query that should group the reminders by the users: ...
0
votes
0answers
10 views

Ruby on Rails application database pool size configuring with PostgresQL and Unicorn deployed to Heroku

I have Ruby on Rails application deployed to Heroku where ActiveRecord-calls seem to take long. The application itself requires that the DB is polled pretty frequently, though there are some querys, ...
1
vote
1answer
21 views

Rails Active Record TimeZones

I have set the default time zone of my application to Pacific Time. config.time_zone = 'Pacific Time (US & Canada)' config.active_record.default_timezone = 'Pacific Time (US & Canada)' The ...
0
votes
1answer
20 views

Rails Scope - Get all Products where ProductCategories.size > 0

I have a simple three way model association where a Product can belong to multiple Categories. Product has_many ProductCategories ProductCategories belongs_to Product ProductCategories belongs_to ...
-1
votes
0answers
25 views

PostgreSQL 9.4's hstore, ActiveRecord, and Mongoid

So, like many of you, I'm super stoked for the 9.4 release of PostgreSQL. Question, though. I'm wondering if we'll be able to use some tools together. As the title suggests, I'm wondering how Rails' ...
0
votes
0answers
15 views

Is the server connected to localhost and is running on port 5432 error

I am working on an old rails app (version 2.3) and I'm unable to test my unit models because when I run rake db:test:load I receive this error message: Is the server running on host "localhost" ...
0
votes
1answer
34 views

gitlab Error 500 after updating when viewing projects

dpkg-query -W gitlab gitlab 7.3.2-omnibus-1 We have gitlab 6.9.2 running on Ubuntu 14.04.1 LTS. After following the instructions found here ...
0
votes
0answers
29 views

Elasticsearch versus PGsearch versus simple sql like

I am having a Ruby on Rails application which has its search implemented using elastic search. It is using Postgresql as database. There are two tables ticket and ticket_message. One ticket has_many ...
0
votes
1answer
35 views

How to select unique values from a single column, with a default scope, returning multiple columns

In a rails application I need to return an ActiveRecord collection containing multiple columns, but only 1 column must be unique. There is a default scope which is not the unique value. Default ...
0
votes
0answers
14 views

Rails hstore map of maps? [duplicate]

I'm using an hstore column: add_column :my_table, :entities, :hstore And I store in it a map of arrays: { likes: ['football','soccer'], post: [1,3] } However, when I load it from the DB, I ...
0
votes
5answers
79 views

Rails has_many with an integer primary key and a string foreign key

I have three rails objects: User, DemoUser and Stats. Both the User and the DemoUser have many stats associated with them. The User and Stats tables are stored on Postgresql (using ActiveRecord). The ...
-1
votes
0answers
13 views

What's the best (fast and searchable) way to store hierarchical structure using rails and postgres

I'm making a classified advertisements website. There are trees for categories and filters, that depend on the category. For example, category in the path 'auto/used-cars' has the following filters: ...
0
votes
0answers
24 views

Rails :Passing parameters from view to controller

i am developing rails application where i have something like collecting feedback from users after serving them. i have a questions table ( id, question, type ) where type is to used to determine if ...
0
votes
0answers
31 views

serializing and eager loading nested polymorphic relations in rails

I've been working on a small learning management system and I have essentially the following model setup. class Course < ActiveRecord::Base has_many :assets, :through => :course_assets ...
0
votes
2answers
25 views

Rails 4.1 with pg 0.17.1 — can't modify fields in model instance

I'm working in rails 4.1 with a postgres backend, handled by the 'pg' gem (0.17.1). When I try to update and save some plain integer/string fields, the change seems to be successful but doesn't get ...
0
votes
1answer
16 views

rake db:test:prepare erroring out due to PG error

Some of my rSpec tests are failing and I suspect it's due to the test database not being cleared out. When I try to run rake db:test:prepare, I'm getting the error below (i'm in Rails 3.2). Clearly, ...
0
votes
1answer
32 views

Postgresql: How to perform cross db queries

I currently have 2 same schema databases (1 for staging and 1 for production). One issue I had was by accident the staging was used with real production data, I simply can't manually input it on the ...
0
votes
1answer
15 views

Binary file attachment “unrecognizable format” for postresql and rails 4

I currently have a problem with storing files as binary blobs on postresql (9.3) with ruby on rails (4.1.1). When opening the file from staging/production server that I have saved, I get ...
-1
votes
1answer
31 views

How to easily clone a production postgresql database to staging [duplicate]

I have data in a production database but want to test out some new features so I've set up a staging environment on the same server and want to use the data from the production database with my ...
1
vote
1answer
19 views

PG::ConnectionBad Error when trying to run rake db:migrate after creating model, using postgresql

Trying to get my rails up and running but am having a problem. When creating my new rails app on the command line I ran the usual rails new PhotoApp -d postgresql Generated my core scaffold. Then ...
3
votes
1answer
44 views

How to fix PG::DuplicatePstatement: ERROR?

I would like to know how to prevent this type of error. So far I tried disabling prepared statements via the database configuration at AWS Opsworks: Eg: Database Configuration }, "deploy": { ...
-1
votes
2answers
42 views

Rails Project and cannot get db:migrate with postgresql

Hey I recently started working on a Ruby on Rails project. I cloned the directory and when I try to run rake db:migrate or rake db:setup or rake assets:precompile I get this: ...
0
votes
1answer
22 views

Exporting CSV from Rails postgres database - Adding Associations

I am trying to export information about users of my Rails app (that's hosted by Heroku). I followed this tutorial to export a CSV file: https://coderwall.com/p/jwtxjg This involved the following: ...
0
votes
2answers
34 views

Ruby on rails unique records

What is the best way to return the unique records from the database, please consider the following : @users = User.joins('LEFT JOIN subscriptions s ON users.id = ...
0
votes
1answer
42 views

Rails, formtastic and postgres: NotNullViolation

this one isnt googling at all, so i have no choice but to bother you with such braincracker. I have 2 models, linked through HMT. I also have ActiveAdmin. When I try to create object from 1st model, ...
2
votes
0answers
38 views

How to delete HSTORE keys?

I have the following migration: class CreateFoos < ActiveRecord::Migration def change create_table :foos do |t| t.hstore :foos_properties end end end In the hstore column, I ...
0
votes
1answer
30 views

Setting default value when sorting by association

Background: I'm working on making a simple clone of Hacker News using Rails and Postgres. I've got most everything finished, and I'm currently working on allowing a visitor to the site sort the ...
0
votes
0answers
20 views

Multi Tenancy With Rails4 & Postgresql [duplicate]

We are going to implement Multi Tenancy With Rails4, i want experts review on this because it's going to be a big app. Is it a good choice to use Postgres Schema ? Will it cause any performance issue ...
1
vote
1answer
26 views

How to get values from different table using association in rails?

I've two tables in my Postgres database structures given below: CREATE TABLE tables( id serial NOT NULL, name character varying(255), table_state_id integer, table_type integer, CONSTRAINT ...