I want to put some model level verification in the following table:
create_table :audios do |t|
t.integer :library_id, :null => false
t.string :file, :null => false, :limit => 2048
t.string :name, :limit => 512
t.timestamps
end
Does this mean that my model, which (for now) looks like this:
class Audio < ActiveRecord::Base
belongs_to :library
end
It has
class Audio < ActiveRecord::Base
validates_presence_of :library
...
or
class Audio < ActiveRecord::Base
validates_presence_of :library_id
...
?
source
share