Data dodania Pytanie
2017-02-17 13:02 Rails multiple joins condition query for exact tags with has many through relationships »
I have a problem with filtering products by exact tags as my current query does not return exact matches and I can't seem to get the right query condi...
(1) odpowiedzi
2017-02-17 06:02 ArgumentError when storing point using RGeo »
I'm having some trouble storing a point in RGeo. initializer/rgeo.rb RGeo::ActiveRecord::SpatialFactoryStore.instance.tap do |config| # By default...
(0) odpowiedzi
2017-02-16 20:02 How to save 'Yes' or 'No' instead of 'true' or 'false' with Rails check_box form helper? »
I have an object @recipient with attribute responding. Say, I want responding to store "Yes" or "No" via =f.check_box :responding, {}, 'Yes', 'No', wh...
(2) odpowiedzi
2017-02-16 00:02 How to order records by created_at last 3 days first, then by another column, using rails [Postgresql] »
Using Active Record, How to order by 2 columns (created_at, views): 1st: the records created within the last 3 days 2nd: everything after that shoul...
(2) odpowiedzi
2017-02-15 18:02 Rails 5 includes and polymorphic »
I'm using Rails 5 and try to do next class Song has_and_belongs_to_many :artists end class UnknownSong end class Library belongs_to :media, pol...
(0) odpowiedzi
2017-02-15 15:02 It is possible to use the new ActiveRecord::Attributes API in a PORO? »
I usually include ActiveModel::Model into some PORO (for example for a FormObject::SignUp). I've read about the new Rails 5 ActiveRecord::Attribute A...
(2) odpowiedzi
2017-02-15 13:02 Automating pairing in ruby on rails database »
I have a site where users can register and view thgeir profile with their data showing.. I created two columns paid which is boolean(default: false) a...
(0) odpowiedzi
2017-02-14 11:02 Rails version migration issue (Rails 4.2 to 5.0) »
When migrating from rails 4.2.6 to 5.0.1, I am getting some errors: undefined method `push' for #<User::ActiveRecord_Relation: while doing: @us...
(2) odpowiedzi
2017-02-14 10:02 How to filter the array of records per model name ruby on rails »
Suppose I have hashes of elements and I need to filter out the results based on the class names in them. so, if records contains elements of PrivateS...
(2) odpowiedzi
2017-02-14 05:02 How to find records where a column value = [given array] in rails »
Setup: Rails + Postgres. I have table A with columns id: int, name: string, address: string, s_array: varchar[], i_array: int[], created_at: dateti...
(3) odpowiedzi
2017-02-13 01:02 Rails 5 Query when using both single and multiple association relationships »
I have a rails app with the following setup: class Organization < ApplicationRecord has_many :user_orgs has_many :users, :through => :u...
(1) odpowiedzi
2017-02-12 22:02 Active Record where join table record doesn't exist »
I am trying to get a list of all records that don't exist in a join table. The models are User, Game and MarkedGame, where users can mark games as pl...
(2) odpowiedzi
2017-02-12 08:02 Ransack - Acts as Taggable On - Not tagged query - Error »
I am making a search form with Ransack to query a resource with the presence or not presence of a tag. For example, if I want a tag Archived, I will ...
(0) odpowiedzi
2017-02-12 04:02 Change model attribute name based on status? »
I have a Match model that has 3 users: an observer, a player1, and a player2, and a status enum (which could be finished or pending). When the Match ...
(2) odpowiedzi
2017-02-11 04:02 How to find number of records based on association through join table »
I have User, Assignment, and Account models. Users can belong to many accounts and accounts have many assignments. As an admin on an account you can '...
(2) odpowiedzi
2017-02-10 14:02 Rails - how to incorporate 'quantity' bookings using counter_cache and update correctly »
I'm building an events app using Rails and have added a counter_cache association between my Event and Booking models in order to capture the number o...
(1) odpowiedzi
2017-02-09 14:02 Rails - counter_cache not working »
I'm building an events app using Rails and have added a counter_cache association between my Event and Booking models in order to capture the number o...
(1) odpowiedzi
2017-02-09 10:02 find_or_create_by trying to create duplicate records with hmt association »
I'm curious if there is another way of achieving the following. Setup: class Cabin < ApplicationRecord has_many :feature_groupings has_many ...
(1) odpowiedzi
2017-02-08 22:02 Multiple LIKE and AND operators in RAILS/POSTGRESQL »
I'm using Rails 5.0.1 and Postgresql as my database. I have a table with column :content which contains words. The problem: When I'm looking for a sp...
(3) odpowiedzi
2017-02-08 18:02 Rails has and belongs to many duplicate entries »
I have 2 models and a join table('email_addresses_mailable_events'). Database being used is Postgres. class MailableEvent < ApplicationRecord ...
(0) odpowiedzi
2017-02-07 00:02 Why would updates to a paper_trail-enabled model fail silently? »
Rails 5.0.0, Heroku Postgres 9.6.1 m = MyModel.create(foo: 'bar') => #<MyModel foo: 'bar'> m.foo = nil => nil m.save => true m.reload ...
(0) odpowiedzi
2017-02-06 22:02 CRUDL - Accessing ROR item with parameter other than id »
I am designing a Web API and a local database for devices to use. These databases sometimes communicate. Because items in each database have different...
(1) odpowiedzi
2017-02-05 12:02 Have CKeditor use custom model »
I am trying to create a setup where only one table is used for files including ckeditor. As it stands I am using the default with table that is genera...
(1) odpowiedzi
2017-02-03 19:02 How do I completely avoid using a database in RSpec tests? »
I want to use FactoryGirl to build in-memory stubs of models, then have all ActiveRecord queries run against only those. For example: # Assume we st...
(1) odpowiedzi
2017-02-03 01:02 How to replace model associations in-memory in Rails? »
Let's say I have a Person model, that a Person has many Pets and a Pet has a polymorphic association to Dog and Cat. Note that a person cannot have an...
(2) odpowiedzi
2017-02-02 11:02 Rails app does not sort publications by year »
I have a Rails 5 app with publications. These publications need to be ordered by year, with recent years on top. The years field on a publication has...
(1) odpowiedzi
2017-02-01 23:02 Quering a has_many_through join table in Rails »
I have an app in Rails 5 where I have the following relationships: User model has_many :consult_users has_many :consults, through: :consult_users ...
(1) odpowiedzi
2017-02-01 21:02 Controller / ActiveRecord .where(...NOT IN...) with possible empty in set »
$ ruby -v ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux] $ rails -v Rails 4.2.0 $ grep DESCR /etc/lsb-release DISTRIB_DESCRIPTION="Ubuntu ...
(1) odpowiedzi
2017-02-01 13:02 ActiveRecord::StatementInvalid PG::UndefinedColumn: ERROR »
I am using rails_admin for admin panel. Just change association in Image model From this class Image < ApplicationRecord belongs_to :user ...
(1) odpowiedzi
2017-01-30 13:01 Rails activerecord dup with associations »
I have a scenario where we run a queue to copy all the events. The events has maps, locations associated with it. I'm able to copy the events but it's...
(0) odpowiedzi
2017-01-30 10:01 active job in rails 4 »
I am looking forward to active job for active record for rails 4. I search related to it. I found gem 'delayed_job_active_record' . But this supports ...
(1) odpowiedzi
2017-01-29 03:01 Could not load 'active_record/connection_adapters/mongodb_adapter »
I have created a new rails app by just the command rails new testApp and when i run the server in dev on my local mac with 'rails s' and then visit l...
(0) odpowiedzi
2017-01-27 22:01 How to get the count of unsaved associated records? »
Given these ActiveRecord table definitions: create_table :parents do |t| end create_table :children do |t| t.references :parent end And the corr...
(1) odpowiedzi
2017-01-27 07:01 Update parent and add child in Active Record »
I get a JSON array of records for POST :- My Parent table model is as follows :- class UserVehicle < ApplicationRecord has_many :service_bil...
(2) odpowiedzi
2017-01-26 17:01 Database query for array data type receives error: No operator matches the given name and argument type(s) »
My Tennis Calendar model has a week attribute set as array data type, since tournaments can last two weeks. As an example, the first element is below:...
(1) odpowiedzi