Kir
Kir

Reputation: 8111

Using link_to with routes

My route:

  scope "/ajax" do
    resources :companies do
      resources :comments
    end
  end

So, link_to company.title, company generates such url: /ajax/companies/1

How to generate clear url without the first /ajax/ part? As a result i want to generate companies/(:id) and companies/create and companies/edit/(:id)

Upvotes: 0

Views: 293

Answers (1)

MattMcKnight
MattMcKnight

Reputation: 8290

The obvious answer is to remove the scope '/ajax' do line, but I have a feeling that is not what you are looking for. Maybe just put the resources line in there again outside of the scope block.

Is ajax a module? If so, just replace it with scope :module => 'ajax' do.

Upvotes: 2

Related Questions