Forum: Ruby on Rails Cleaner way to do this

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community 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
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   :-)

Thanks.
This topic is locked and can not be replied to.