Ruby on Rails
Saturday, December 23, 2017
Hi andre, like hassan is pointing out, your code wil become very needlessly complex pretty soon because you are not separating responsibilities or the classes, the controller is a class that should only be handle handling where to direct the request, not actually performing operations on the data or what ever. If you keep going that route the controller will become a huge procedural app in itself. You should have something like this there
```
Match.new(params[:match_data]).simulate()
```
```
And then simulate should hide all that complexity from the controller.
In any case, please explain better the problem you are trying to solve.
On Fri, Dec 22, 2017 at 8:16 PM, André Luiz Abdalla Silveira <andreluizsa00@gmail.com> wrote:
Guys, I'm making a baseball league application, and I'm facing some challenges. Biggest of them is trying to make a match simulation method (I didn't think a view was necessary for it). This method is in matches_controller.rb, but again, there isn't any view for that. How do you think I should handle it? Have you ever faced any similar trouble?--Git repository: https://github.com/dede999/myMLB PS: I love sports at all, so if you have a hockey application to share (it doesn't have to be written in Rails), please do it
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/ .dc886a29-58d4-497a-a7dd- a29370b84dfd%40googlegroups. com
For more options, visit https://groups.google.com/d/optout .
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/CANkJ5gnkDVLMCxa8cuwk-aWfr7sxwu47gaFd9Ho4su3CoC5xEA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment