Fernando Flores


140 Experience
0 Lessons Completed
0 Questions Solved


Wonderful, thank you =)

Thank you much Chris, I may be wrong but this is the kind of detail I have not found in books like Obie Fernandez's 'The Rails 4 way', Hanson's 'Agile Web Development with Rails 5' nor Michael Hartl's 'Ruby on Rails Tutorial' which I have, not even in the Rails guides... What documentation or book do you recommend to get a deep knowledge on these details?

Now I get this

TypeError: wrong argument type Class (expected Module)
from /home/lflores/Projects/cna-bdays/app/models/licencia.rb:2:in `include'

I'm confused...

I wrote a custom validator for a model in my app, but when I try to access that model I get

LoadError: Unable to autoload constant Validators::LapseValidator, expected /home/lflores/Projects/cna-bdays/app/models/validators/lapse_validator.rb to define it 'load missing constant'

Here is a gist to the involved code: https://gist.github.com/lflores1961/8ad21b6e903cd4e2028133087ea23f08
What am I doing wrong? please help

Posted in Where do I put a custom validator for a model?

Thank you Chris, so I guess it be ok if I put it inside the concerns folder. One more thing should it be a module or just a class definition?

Posted in Where do I put a custom validator for a model?

I'm confused about where to put code for a custom validator I wrote, should I create a nested class inside the model file? or create a new file in models/concerns? I have the code but don't know where is the right place to put the file, can someone help me please?

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2021 GoRails, LLC. All rights reserved.