activerecord
Rails Models: Legacy Schema: Table Inheritance
I have a legacy SQL schema which looks something like this: CREATE TABLE `User` ( `id` bigint(20) NOT NULL AUTO_INCREMENT,[详细]
2023-04-09 11:03 分类:问答Ruby on Rails: How to have ActiveRecord callback load a shared variable between callbacks
I have a couple of before_save and after_save callbacks that need to share an instance of an object between each other in a Ruby on Rails project. I thought that adding an additional method called loa[详细]
2023-04-09 10:27 分类:问答How can I fix this Rails AR query to get records that are at least 5 minutes old?
What is the best way to write a Rails query that returns records that are at least 5 minutes old? I am using Rails 3.0.1, Ruby 1.9.2 and PostgreSQL. At the moment I have this:[详细]
2023-04-09 10:05 分类:问答Rails 3 scope undefined method `includes_values`
My model has this scope scope :supported, order(\"name\").collect {|m| m.name}.join(\", \") and it throws an error[详细]
2023-04-09 09:53 分类:问答Strange behaviour when returning an array from class_eval'ed method
With Ruby 1.9.2, I\'m using class_eval to extend a class. def slugged(fields) # assign string to variable only for easier debugging[详细]
2023-04-09 08:57 分类:问答Rails 3.1 Active Record - loading the parent object in a has_many :through relationship
I have the following class structure for an app I\'m porting from php to rails: class Menu < ActiveRecord::Base[详细]
2023-04-09 06:37 分类:问答Rails after_save callback being called multiple times
I\'m trying to inject an after_save callback via a mixin, but my rspec tests are telling me that the callback is being called twice when the create method is called.Why is the method 开发者_如何学编程[详细]
2023-04-09 04:44 分类:问答RoR 3.1 - Loading associated objects when querying child with a where phrase
I have the following structure class List < ActiveRecord::Base has_many :global_lists end class GlobalList < ActiveRecord::Base[详细]
2023-04-09 04:29 分类:问答Rails: How to handle model subclassing?
There are ten ways to do anything but what is the best practice approach to organizing the Document and Section models described below in Rails?[详细]
2023-04-09 04:21 分类:问答Rails model inheritance & routing
class User < ActiveRecord::Base has_many :queued_workouts, :conditions => \"queue_position IS NOT NULL\",[详细]
2023-04-09 02:49 分类:问答