activemodel
How to test a custom validator?
I have the following validator: # Source: http://guides.rubyonrails.org/active_record_validations_callbacks.html#custom-validators[详细]
2023-04-12 08:55 分类:问答ActiveModel fields not mapped to accessors
Using Rails 3 and ActiveModel, I am unable to use the self. syntax to get the value of an attribute inside an ActiveModel based object.[详细]
2023-04-10 08:26 分类:问答How to pass argument to delegate method in Rails
I would like to have a Dashboard to display summary of multiple models, and I implemented it using Presenter without its own data. I use an ActiveModel class (without data table):[详细]
2023-04-08 15:42 分类:问答Struct with types and conversion
I am trying to accomplish the following in Ruby: person_struct = StructWithType.new \"Person\", :name => String,[详细]
2023-04-05 23:45 分类:问答Should I use ActiveModel for this simple non-database Rails application?
I\'m building a simple two page Rails application where a user: Enters credit card details on first page and clicks \'Next\'.[详细]
2023-04-02 11:39 分类:问答Rails 3 Models: Can create/update with :association_id => association.id, but not :association => association
This is a problem I regularly run into, and I\'m not quite sure why. Any suggestions appreciated: Suppose I have a relationship between shop and book (book belongs to shop, shop has many books)[详细]
2023-03-30 20:23 分类:问答Custom method after some validation passes
Ok. 1) I need to validate :link in my model and do that only if it is not blank (or nil). 2) If :link is not 开发者_运维问答blank and standard validation passes — I need to run my custom validati[详细]
2023-03-30 01:27 分类:问答Rails, using the dirty or changed? flag with after_commit
I heard rails has a dirty/change flag. Is it possible to use that in the after_commit callback? In my user model I have:[详细]
2023-03-29 19:04 分类:问答Rails: Getting list of attributes with uniqueness validations from a model
Just wondering if it\'s possible to return a list of all attributes which possess a uniqueness validation? For example, I have a model Person - I\'d like to return a list of the attributes in \'Person[详细]
2023-03-29 02:42 分类:问答ActiveModel cascading validator for object and all of its children
I have a class that uses ActiveModel (not ActiveRecord though). It represents a JSON object retrieved from a remote webservice. The track object has an array of ReportLayout objects, and each ReportLa[详细]
2023-03-29 01:41 分类:问答