activerecord-validations-readme's People
Forkers
brianmenard dev-learn-co-curriculum chriswigington emilycroft itzsaga tracypholmes dianawhalen crankums jendirmeyer mjtv128 bennylouie mat0829 betalantz markdenardo assansav amberganda mrh9ud clashbuster hamcodes seaneriksen25 geoffwv feniusfarsaid dlynnea truec-d chaochaocodes mug913 kierblk fitzlegit cleansolllc tonester92 kkirby16 maylenepoulsen vesnavucinic se732 acasarsa vmar13 cbreakr josephscha johnsonnyc codenameuriel danielxurbina uchoosecode gcampbell391 alexjmartinez meoriordan programmingmanzo jmb521 nicksolony big32mike rfgr87 twwright dbsk11 nicolequeen jeanmariejackman dannypadron09 mclarkef90 haleighdalke sincerelybrittany joedegr jaesonwatts eprenzlin ejguzman3988 sohyunc1990 vladdaimpaler18 lovecosma slurio danamyakar austinrhoads doobert0814 theprivatepark ashleymader pete3249 modacoder kylefarmer85 zackcarlson014 skyler-littleaxe jason1110 developingdina eulis01 kam3r0nz waynedelcorraljr crrojas88 dcoppage86 billyott carlj0666 15jramirez edougher bjf-flatiron khargr14 hydroflux jbondeson19 waltercito1 jamondixon phonglo724 mikebarberry-flatiron speraza545 jahaira-marrero haleywarson orchardtree violacelloactiverecord-validations-readme's Issues
record.errors[:name] should be record.errors[:email]
At the bottom of the ActiveRecord Validations readme there is an example defining a custom validation. If there is an error in the description it says you should push an error message into record.errors[:attribute] e.g. record.errors[:email] but directly below that there is the text "The result of these steps should be the following:"
class EmailValidator < ActiveModel::Validator
def validate(record)
unless record.email.match?(/flatironschool.com/)
record.errors[:name] << "We're only allowed to have people who work for the
company in the database!"
end
end
end
--
In this example on line 4 it references record.errors[:name] not record.errors[:email]
Needs more explanation?
Apologies if this is not the right forum/form to make this comment in, but I think the section on custom validations needs a little more meat on the bones. Maybe a few examples? I realize the curriculum's huge and this is probably a minor sub-topic, but I definitely don't understand when to use each custom validator option or even where to build the class for a custom validator (in a separate .rb file in the models folder??). I was able to get through the subsequent lab through trial & error, but I think a little more explanation would be really helpful here! Also, I of course used the http://guides.rubyonrails.org/active_record_validations.html site, but I didn't find their explanation any more helpful than what we have here. Thanks!
End of the lesson goes from 0 to 100 real quick
The Custom Validators section is confusingly written. The linked Rails guide is a much better resource.
Custom Validators section should be it's own lesson
This portion of the lesson is not well-explained and really should be it's own lesson. Also, consider only teaching #validate for custom validations.
typo
"If your validation needs become more complex, consult the documentation."
...needs TO become more complex
confusing terminology
"We can use ActiveRecord::Base class methods like #validates to set things up."
#validates is not a class method. I think it meant to say,
"We can use ActiveRecord::Base instance methods like #validates available to our classes to set things up."
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.