aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/connection_links_controller.rb
blob: 327fb7989aa2e2cac504279ef1a8990bb51f0176 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class ConnectionLinksController < ChouetteController
  defaults :resource_class => Chouette::ConnectionLink

  belongs_to :referential do
    #belongs_to :departure, :parent_class => Chouette::StopArea, :optional => false
    #belongs_to :arrival, :parent_class => Chouette::StopArea, :optional => false
  end

  respond_to :html, :xml, :json


  protected

  def collection    
    @q = referential.connection_links.search(params[:q])
    @connection_links ||= @q.result(:distinct => true).order(:name).paginate(:page => params[:page], :per_page => 10)
  end

  def resource_url(connection_link = nil)
    referential_connection_link_path(referential, connection_link || resource)
  end

  def collection_url
    referential_connection_links_path(referential)
  end

end