Karthik Kantharaj wrote:
> 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 ?
> 
> --
> Karthik.k
> Mobile - +91-9894991640

Write class methods in Model. Call those from Controllers by passing the 
arguments.

controller method

def example
  User.method_name(arg1,arg2)
end


In User Model

def self.method_name(parm1,param2)
  write your find here
end


Thanks
Siva
-- 
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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to