Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined method in styleguide view #12

Closed
stoplion opened this issue Oct 18, 2012 · 10 comments
Closed

undefined method in styleguide view #12

stoplion opened this issue Oct 18, 2012 · 10 comments

Comments

@stoplion
Copy link

Getting an..
undefined method `[]' for nil:NilClass
in..
<h3><%= section.section %> <em><%= section.filename %></em></h3>

@dewski
Copy link
Owner

dewski commented Oct 18, 2012

Could you paste your config/routes.rb file? Or at least confirm it has mount Kss::Engine => '/styleguide'.

@stoplion
Copy link
Author

I can confirm it's in routes file..
mount Kss::Engine => '/kss' if Rails.env.development?

Should this be in routes as well?
mount Kss::Engine => '/styleguide'

@dewski
Copy link
Owner

dewski commented Oct 18, 2012

You changed the original issue after I commented on it. You mentioned you were trying to get /styleguide? What happens when you go to /kss, and have you restarted the server?

@stoplion
Copy link
Author

I can navigate to http://localhost:4000/kss/ There it displays some links, Home and Styleguide. Styleguide is where i get the above error on line two <h3><%= section.section %> <em><%= section.filename %></em></h3>

@dewski
Copy link
Owner

dewski commented Oct 18, 2012

I'll need the full backtrace to give a deeper look, undefined method[]' for nil:NilClass` and whatever else comes after that.

@stoplion
Copy link
Author

undefined method `[]' for nil:NilClass

Extracted source (around line #2):

1: <div class="styleguide-example">
2:   <h3><%= section.section %> <em><%= section.filename %></em></h3>
3:   <div class="styleguide-description">
4:     <p><%= section.description %></p>
5:     <% if section.modifiers.any? %>

Trace of template inclusion: app/views/kss/home/styleguide.html.erb

app/views/kss/home/styleguide.html.erb:1:in `_app_views_kss_home_styleguide_html_erb___1281663321373551429_2526041660'

@JAndritsch
Copy link

Sounds like you're might be trying to call "styleguide_block" with a section that doesn't exist in your CSS. For example, if you want to call "styleguide_block '1.0' ", you have to make sure you have "Styleguide 1.0" somewhere in one of your CSS files. That was at least my issue when I first started using this.

@jankeesvw
Copy link
Contributor

I've had this questions several times in my team, I have fixed this by adding an error when the section is nil.

Undefined styleguide

@jankeesvw
Copy link
Contributor

More descriptive error with my this patch: #18

@jankeesvw
Copy link
Contributor

This issue can be closed, it's fixed!

@dewski dewski closed this as completed Feb 24, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants