Top "Rails-models" questions

a component of the Rails framework that holds the state of an object and is responsible for enforcing business rules and persisting the object.

LoadError Unable to autoload constant Message

In my app; when I submit form, I get this error: LoadError at /questions Unable to autoload constant Message, expected /…

ruby-on-rails activemodel rails-models mailboxer
Rails has_one :through association

Rails has a has_one :through association that helps set up a one-to-one association with a third model by going …

ruby-on-rails associations rails-activerecord rails-models
What is the best way to drop a table & remove a model in Rails 3?

I have a model & a table which I no longer need in my App, I could leave them there …

ruby-on-rails-3 heroku rails-migrations rails-models
How to have multiple conditions in a named scope?

I have a User model. I can check whether a User is an admin by doing a_user.try(:admin?). …

ruby-on-rails model scope named-scope rails-models
Ruby on rails - access model data within another model

I want to access a column from OtherModel.rb to MyModel.rb. Is that possible? this is what it looks …

ruby-on-rails rails-models
Specify an optional reference in your Rails model

I have a Sponsors model and a Promo Codes model. A sponsor can have zero or more promo codes A …

ruby-on-rails ruby-on-rails-4 rails-models
Nested attributes for belongs_to association rails

I have two models, Complaint and Company. Complaint belongs_to and accepts_nested_attributes for Company, and Company has_many …

forms ruby-on-rails-3.2 has-many belongs-to rails-models
In Rails, how should I implement a Status field for a Tasks app - integer or enum?

For a Rails 3.0 Todo app, I have a Tasks model with a Status field. What's the best way to store …

html ruby-on-rails enums rails-models
Shared models between two Rails apps - what is the ideal solution for Workflow?

I am currently working on a Rails 3 project that is divided up into four parts: The public facing website The …

ruby-on-rails backend rails-models
Ruby on Rails: how to migrate changes made on models?

In a Rails application, how can I migrate the changes I make in models? For instance, I know that if …

ruby-on-rails ruby ruby-on-rails-3 rails-migrations rails-models