0
votes
0answers
58 views

Sum returning null

I am having a problem with a Ruby SQL look up function: it always returns a null. Here is the terminal output: SELECT COUNT("point_store_items"."point_cost") FROM "point_store_items" INNER JOIN ...
0
votes
0answers
16 views

Update another table with the newly created foreign key

Could somebody advise what code should be added in order to ensure that the created new id for a one table will be updated in the table from where the ID is used ( the id from table Appointments has ...
0
votes
2answers
15 views

Rails seed.rb can't find table that exists in schema and SQL

Class is a reserved word, so I have changed the table name from class_assignment to cassignments to avoid any chance that that is the error causing it (despite me having class_instruction(s). I have ...
0
votes
2answers
18 views

Rails Active record association by instance methods

I am trying to have (devise) users.rb be placed within a ClassInstruction.rb based on their userRole.rb (teacher or student). The models and schema are below, along with the error. It errors on ...
1
vote
1answer
21 views

find_or_create doesn't pass second condition to create

There are two entities here - facilities and agencies. Each facility belongs_to :agency I am writing the seed script for the database that reads CSV files and parses out data. This should add ...
0
votes
1answer
23 views

Upgrade to Rails 3 and lost ability to run Active Record database migrations

I have a corporate web application that, for various reasons, has Active Record connections to SQL Server as well as Mongoid Documents. There has been resistance to updating to Rails 3 until now (yes, ...
1
vote
1answer
21 views

Rails SQL insert statements not showing up in console

My terminal used to display SQL table insert statements (as it should by default), and now it doesn't. Everything else - for example, GET requests, or local server startup info, or job completion ...
0
votes
1answer
90 views

Complex Rails/Postgres SQL optimization

Restaurant has_many Dish Dish has_many Photo Photo belongs_to Dish Restaurant 1 Dish 1 Photo 1 May 9, 1:00 PM Dish 2 Photo 2 May 9, 2:00 PM Dish 3 Photo 3 May 9, 3:00 PM ...
2
votes
1answer
69 views

Order with a has_many relationship

I have Articles that have_many Metrics. I wish to order the Articles by a specific Metric.value when Metric.name = "score". (Metric records various article stats as 'name' and 'value' pairs. An ...
0
votes
1answer
39 views

How to trim database column in SQL comparison for rails 3.2.12?

Please look at the following example: UserAccess.where("action = ? AND resource = ? ", 'index', 'logs') The issue we are facing is that there are white space in column action and resource in ...
0
votes
1answer
62 views

Rails Ransack search to get sum of association with conditions

Sorry if the title is unclear - I am not really sure how to word this question. I am using rails 3.2, postgresql, and ruby 1.9.3. I have two models: Order, which has many Items. Orders have a ...
0
votes
1answer
33 views

Rails .where using AND / OR

I have a model Tasks that has the fields completed:boolean and completed_date:datetime. If a task is completed it will have the date when it was marked as completed, or else completed_date would be ...
0
votes
1answer
31 views

Does putting a limit to the size of a string attribute in Rails make the database smaller?

If I am using mySQL or Postgresql does putting a limit on the attribute shrink the size of the database? I guess this may be a silly question, but I am a little unfamiliar with how database size adds ...
0
votes
1answer
35 views

Are those two queries the same in rails 3.2.12?

We need to retrieve logs for customer comm record in our rails app. The condition in plain english is logs for customer_comm_record based on: #1. the sales_id in customer comm record's customers is ...
1
vote
0answers
26 views

scope for count children has_many relation

I have two models # == Schema Information # # Table name: answers # # id :integer not null, primary key # content :text # question_id :integer # accept :boolean # ...

1 2 3 4 5 32
15 30 50 per page