Quoting karthik k <cse.k.kart...@gmail.com>: > Hi guys > > My client asked me to do all the Model.find() in Model class i.e all > database interaction should be in model class and not in controller > I don't know how to do that > > I need to pass details from html to model and do database work and send back > to view > > I need some help > > Any sample link or any advice ? >
Uhh, get a new client? If the client knows enough to dictate that level of programming, either they don't need you or you don't need them. But less cynically, ask them what they are trying to accomplish by this. Some guru told them the "One True Way"? It may be reasonable to require all SQL be in the model class. The whole purpose of the find() method is to program database access in Ruby without knowing SQL. The crude, ask no questions response is to take pluck out every find() call and a reasonable amount of context in the controller and wrap it in a method in the model and call that. But, I would really try and get some clarification on why and what they expect to accomplish by this change. On the face of it, it seems very unreasonable. HTH, Jeffrey --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---