Skip to content

Instantly share code, notes, and snippets.

@senny
Created December 4, 2012 15:33
Show Gist options
  • Save senny/4205195 to your computer and use it in GitHub Desktop.
Save senny/4205195 to your computer and use it in GitHub Desktop.
class User < ActiveRecord::Base
validates :account_id, :presence => true
end
# in the View (using simple_form):
#
# f.select :account, :collection => Account.all
# It would be awesome to validate on the :account_id field but have the error on the :account field
class User < ActiveRecord::Base
validates :account_id, :presence => true, :error_field => :account
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment