Forum: Ruby on Rails Cleaner way to do this

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Matias S. (Guest)
on 2006-06-09 00:28
(Received via mailing list)
is there a cleaner way to achieve this? // Is this the correct way?

def show_servers

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

  render :layout=>false

I feel like I'm putting to much sql code for a rails application   :-)

This topic is locked and can not be replied to.