kss-rails icon indicating copy to clipboard operation
kss-rails copied to clipboard

“Routing Error: No route matches”

Open alanhogan opened this issue 13 years ago • 3 comments

After adding the kss-rails gem and running rails generate kss:install, I can see the KSS line was added to my routes, but going to /kss (and as far as I can tell, only URLs that start with /kss) results in this error:

Routing Error

   No route matches {:controller=>"statements"}

Try running rake routes for more information on available routes.

We do have a StatementsController, and it is in fact reachable (still), though the URL isn’t /statements.

Is KSS trying to do something special with our existing routes or controllers?

What might be causing this error?

alanhogan avatar Jun 04 '12 16:06 alanhogan

Hmm. Resolved this.

The issue was that I had a before_filter on ApplicationController that was trying to use our app’s routing helpers like statements_path – but apparently since it was executing in the KSS app context, that wasn’t working.

It should have been a helper, anyway, so that’s how I resolved it.

alanhogan avatar Jun 04 '12 17:06 alanhogan

Not sure if this is related, but is there any way to have other routes other than home_path/styleguide. For instance if I set my root kss url to styleguide, can I create styleguide/buttons, styleguide/forms, etc? Anyone have experience doing something like this with the gem?

tylerwolff avatar Jan 31 '13 16:01 tylerwolff

You should be able to do something like this (although untested):

In config/routes.rb:

Some::Application.routes.draw do
  get '/styleguide_path/buttons' => 'styleguide#buttons'
end

In app/controllers/styleguide_controller.rb

class StyleguideController < Kss::ApplicationController
  def buttons
  end
end

You can always fork the project and add as many routes and actions as you like and just point to the repo in your Gemfile.

gem 'kss-rails', :github => 'username/kss-rails'

dewski avatar Jan 31 '13 20:01 dewski