activemodel
ActiveModel destroy after calling new
I\'m working with a controller that follows the resource_controller principle explained here. As you can see, I don\'t have full control on the (new, create etc...) all of them preload data, which m[详细]
2023-03-08 00:10 分类:问答Rails 3 custom formatted validation errors?
With this model: validates_presence_of :email, :message => \"We need your email address\" as a rather contrived example.The error comes out as:[详细]
2023-03-07 07:56 分类:问答Rails 3: Dependent => :deny or similar?
I have a model \"location\", which has many \"courses\" If I destroy a location, I\'d like the destroy request to be rejected unless there are no relationships between the location and any courses. I[详细]
2023-03-05 07:53 分类:问答Controlling the order of rails validations
I have a rails model which has 7 numeric attributes filled in by the user via a form. I need to validate the presence of each of these attributes which is obviously easy using[详细]
2023-03-04 23:04 分类:问答Rails 3: Display validation errors for a form (not saving an ActiveRecord model)
Apologies if this is a really common and/or ridiculous question; I swear I\'ve read over the documentation multiple times and everything seems so focused on ActiveRecord to the point they\'ve wandered[详细]
2023-03-02 19:44 分类:问答Rails 3: Where to store shared methods for models?
I have a method \"random_password\" that I\'d like to be able to access from multiple models in my rails 3 project. I\'m just wondering what the convention is for where to store it & how to provid[详细]
2023-02-21 12:11 分类:问答ActiveModel attributes
How do I get ActiveRecord attributes method functionality? I have this class: class PurchaseForm include ActiveModel::Validations[详细]
2023-02-20 03:17 分类:问答Rails 3, RSpec 2.5: Using should_receive or stub_chain with named scopes
I use Rails 3.0.4 and RSpec 2.5. In my controllers I use named scopes heavily, for example @collection = GuestbookEntry.nonreplies.bydate.inclusive.paginate([详细]
2023-02-16 07:59 分类:问答Retrieving Rails 3 model with XML column
I have a Rails 3 model that includes a XML column in the database (IBM DB2). Whenever I try to retrieve this model in the XML format by @model.to_xml, I get as result the XML column escaped, something[详细]
2023-02-15 04:30 分类:问答Trouble building an ActiveModel in Ruby on Rails 3 using namespaces
I am using Ruby on Rails 3 and I am trying to build an ActiveModel this way: module Users # I use a namespace[详细]
2023-02-14 18:07 分类:问答