rails-models
Subclassing activerecord and maintain subclass after db fetch
I have an ActiveRecord model Media which is supposed to be able to store similarly structured information about different types of media (Media::Book, Media::Movie, Media::Music). However each of thes[详细]
2023-03-17 23:16 分类:问答Rails assignment table with third column
I currently have a model for an 开发者_如何学编程assignment table in Rails 3, which looks as follows (there are, of course, sale and financeCompany models also):[详细]
2023-03-16 16:08 分类:问答Rails 3 model with belongs_to different tables exclusively in each record
I have some models like these: class Alpha < ActiveRecord::Base has_many :items end class Beta < ActiveRecord::Base[详细]
2023-03-13 02:39 分类:问答Rails Models relationships
Hello fellow developers! Recently I\'ve been playing with Rails 3.0 and after quite a bit of research I\'m kinda stuck.[详细]
2023-03-12 20:35 分类:问答Joining 2 model's data together and ordering them by common column?
I have 2 models that I am interested in merging and then ordering them by the created_at column. One of the models is photos and the other one is statuses. Currently, I have two tabs, photos and statu[详细]
2023-03-11 17:08 分类:问答Require a model to have another model? Basically, a model validation
What I mean is, is it possible in Rails to require at least one instance of a model in a relationship?[详细]
2023-03-11 17:02 分类:问答Rails - Model Doubt
Given the fact that I have models like this: class Person has_many :owned_groups, :class_name => \"Group\", :foreign_key => :owner_id[详细]
2023-03-07 11:53 分类:问答Question about Association and Models on Rails
I have been working on a project recently where a Player can create a Team and be the Team Owner, but a player as well can be part of the Team by a separate table, named Squad.[详细]
2023-03-06 10:18 分类:问答Custom return value for new / create ActiveRecord model
So I have a model (Photo), where when I call Photo.new @image => @image / Photo.create :image => @image, I want my model to find an existing photo with the same image hash OR create a new Photo[详细]
2023-02-26 02:55 分类:问答Rails Updating Data in one Model from another Model's Controller
I have a User model that has billing_id. I have Order model that runs transactions with a payment gateway which returns a billing id I\'d like to save into the billing_id column on the User model. I t[详细]
2023-02-22 17:09 分类:问答