Hi All, I want to shift my Method from Controller to Model, I
have a
controller with no Model because there is no table. Now I want to shift
my
Method from Controller to Model. The code is here…
//////////Dashboard Controller////////////////////////
class DashboardController < ApplicationController
layout ‘standard’
def index
@dashs = Lead.find_by_sql("(SELECT
opportunities.created_on,opportunities.created_by,opportunities.position_title
FROM opportunities) UNION DISTINCT
(SELECT
customers.created_on,customers.created_by,customers.company_name FROM
customers) UNION DISTINCT
(SELECT
leads.created_on,leads.created_by,leads.first_name FROM leads)
ORDER BY created_on DESC")
@dashboards = @dashs.paginate :per_page => 3,:page => params[:page]
end
end
Now I want to make a Model for Dashboard and shift my queries from
Controller to Model.
Thanks & Regards,
Shahroon