Cleaner way to do this


#1

is there a cleaner way to achieve this? // Is this the correct way?

def show_servers

@server_pages, @switch_servers = paginate :servers, :conditions=>[“id
in
(select server_id from server_interfaces where
server_interfaces.switch_interface_id in (select id from
switch_interfaces
where switch_id = ?) )”,params[:id]], :per_page => 20, :order => “name”

render :layout=>false
end

I feel like I’m putting to much sql code for a rails application :slight_smile:

Thanks.