activerecord
How do I force ActiveRecord to load a belongs_to-has_one relation through a JOIN instead of 2 queries?
I have the following models: User < ActiveRecord::Base belongs_to :person end Person < ActiveRecord::Base[详细]
2023-04-12 20:22 分类:问答Is COMB GUID a good idea with Rails 3.1 if I use GUIDs for primary keys?
I\'m using Rails 3.1 with PostgreSQL 8.4. Let\'s assume I want/need to use GUID primary keys. One potential drawback is index fragmentation. In MS SQL, a recommended solution for that is to use specia[详细]
2023-04-12 20:17 分类:问答ActiveAdmin - customising the records that are shown
So I\'ve got an app where users (Devise) have the ability to see either all, or a subset of main model (in this case Schools), depending on whether the user is at branch, region or national level.[详细]
2023-04-12 19:56 分类:问答Rails - ActiveRecord - Trigger mail on change of a field value
I am working 开发者_运维问答on a functionality where i need to trigger a mail to a list of users once the record field value has been updated successfully.[详细]
2023-04-12 19:54 分类:问答How can I do something like find_in_batches_by_sql in Rails
find_in_batches does not allow pure SQL (so fa开发者_如何学Pythonr as I can see). find_by_sql does not have batch support (so far as I can see).[详细]
2023-04-12 19:49 分类:问答How do I perform a ActiveRecord search and remove everyone up to a specific record from an array?
I just tried performing a method, and it failed after hitting a specific object. Knowing the email开发者_运维技巧 attribute of that object, how can I create an array, and limit the return to only tho[详细]
2023-04-12 19:04 分类:问答Is there an equivalent of ActiveRecord::Relation.update_all that triggers callbacks/observers?
I want to perform a bulk update of ActiveRecord models, along the lines of: MyModel.where(:field1=>\"value1\").update_all(:field1=>\"value2\")[详细]
2023-04-12 18:38 分类:问答How do I specify shared attributes translations between models in I18n locale file?
I tried the following: es: activerecord: attributes: name: Nombre And it did not work. But the following do work:[详细]
2023-04-12 18:33 分类:问答Active Record calls join scopes on reload?
I have two scopes with right outer joins declared on my User model. Here they are scope :users_with_school, joins(\"right outer join profiles on profiles.user_id = users.idright outer join profiles_s[详细]
2023-04-12 17:25 分类:问答Rails 3: Skip validation for associated model
It seems that in rails 3 (version 3.0.7) validates_associated is enabled by default (and as a result it is deprecated).[详细]
2023-04-12 17:12 分类:问答