Ruby on Rails Monday, March 30, 2015

Hi (I am a beginner)

I have a project that add users, profiles, etc.
I genetered it using scaffold. It's everything ok up here.
I need to do the crud operations in a service class and not in the
controllers.

I created a services folder into App folder and create a UserService.rb
class .

So the idea is that the controller call to UserService class , and the
userService Class do the crud(create, read, update, delete) operation.


But I got this error message : uninitialized constant
UsersController::UserService .

I tried add a instance to routes.rb , also to application.rb but the
error is still there.

I have searched many examples and tried many things, but can not find
solution.

Any suggestions?
PD: Sorry for my English :)

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3d485b5c851dd12b1113d7fbd0b19c05%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment