DEV Community

Discussion on: Ruby Service Objects without gems

Collapse
 
sergiomaia profile image
sergiomaia

Nice article, very usefull. In the usage example on method user_authentication, shouldn't it be @user_authentication ||= ::UserAuthenticate.run(session_params)? Or am i mistaken?

Collapse
 
oinak profile image
Oinak

Thanks!

Depends on what you have on $LOAD_PATH which in rails can be set up via something like

config.autoload_paths += %W(#{config.root}/app/services)

on config/application.rb. That being said, ::UserAuthenticate is less ambiguous and faster to load, so good point.

If you and/or any reader are into the details, I can't recommend enough Xavier's talks or his post on his new loader Zeitwerk.