Fernando Flores

Joined

1,070 Experience
9 Lessons Completed
0 Questions Solved

Activity

Looks like there is nobody here anymore, but I'm going to post this request for help anyway... I'm getting this error from ostruct and don't know how to solve it (NoMethodError)

hash.each_pair do |k, v|
    ^^^^^^^^^^
from /Users/lflores/.asdf/installs/ruby/3.1.0/lib/ruby/3.1.0/ostruct.rb:128:in `initialize'
from /Users/lflores/Laboratory/RailsLab/pli_third_parties_api_wrapper/lib/pli_third_parties_api_wrapper/object.rb:6:in `initialize'
from /Users/lflores/Laboratory/RailsLab/pli_third_parties_api_wrapper/lib/pli_third_parties_api_wrapper/resources/users.rb:6:in `new'
from /Users/lflores/Laboratory/RailsLab/pli_third_parties_api_wrapper/lib/pli_third_parties_api_wrapper/resources/users.rb:6:in `show'
from (irb):3:in `<main>'
from bin/console:22:in `<main>'

I will try using 'respond_to(:each_pair) to cut the recursivity call to 'to_ostruct(val)'... whish me luck ...

Great series of videos, I'm learning a lot here, Best investment I have made (Forget Udemy LOL). Thank you Chris!

Looks like the code in this episode has evolved over time, I'm watching it (paid my subscription too) in 2022, post pandemic, and the source code is quite different now at GitHub, where can I find the logic behind the code evolution? Thanks, great content, definitely worth the subscription

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.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

© 2022 GoRails, LLC. All rights reserved.