Re: [nesta] list files in directory
- From:
- Chris Malek
- Date:
- 2011-10-04 @ 16:03
I knew I was not grasping some nesta concept. I did not quite
understand the category concept yet but I think I am starting to see
your design.
I think maybe having a dash in the categories is causing a blow up.
I keep getting this error after implementing the changes to the
categories.
NoMethodError at /knowledge-base
undefined method `downcase' for nil:NilClass
file: models.rb location: block in pages line: 288
I created a "test" directory and was able to get the behavior I am
looking for with @page.pages so I am thinking it is that dash in the
category name. I am pointing over an existing website and I want to
keep the URLs the same so I can't easily remove the dash in the url.
I will dig around some more in the code to see why it is blowing up on
that dash or if I made some other mistake.
Thanks for the quick reply.
I actually did have my files on content/page I just messed up in the email.
On Tue, Oct 4, 2011 at 7:50 AM, Graham Ashton <graham@effectif.com> wrote:
> On 4 Oct 2011, at 15:41, Chris Malek wrote:
>
>> The funny things is that @pages.categories is also also empty but in
>> my index.haml I have do have the following line
>>
>> categories: test, test2, test3
>
> The only thing you've done wrong is that you've put the relationship in
the wrong files. Add this to each of your pages that should be in the
knowledge-base category:
>
> Categories: knowledge-base
>
> Also make sure that your files are inside content/pages/, rather than content/.
>
>> = @page.pages.join("-")
>>
>> The statement outputs nothing. I thought this should output all the
>> pages in the same directory and maybe the subdirectory.
>
>
> It doesn't work like that; Nesta only looks at the relationships that
you define via the Categories metadata key. Listing contents of
directories would sometimes be useful, but it isn't always what you want
so I decided it wasn't flexible enough.
>
> @page.pages will list all the pages that specify @page's path in their
Categories metadata.
>
> @page.categories is different; it returns a list of page objects, one
for each of the page's that @page has specified in it's own Categories
metadata field.
>
--
Chris Malek
chris.r.malek@gmail.com
760.230.8625
Re: [nesta] list files in directory
- From:
- Graham Ashton
- Date:
- 2011-10-04 @ 16:15
On 4 Oct 2011, at 17:03, Chris Malek wrote:
> I think maybe having a dash in the categories is causing a blow up.
> I keep getting this error after implementing the changes to the
> categories.
>
> NoMethodError at /knowledge-base
> undefined method `downcase' for nil:NilClass
> file: models.rb location: block in pages line: 288
Do you mean having "-" within the path of a page is a problem? If so, it's
not. See nestacms.com's content for examples:
https://raw.github.com/gma/nestacms.com/master/content/pages/docs/creating-content/changing-the-markdown-processor.mdown
It looks like you've created a page that doesn't have a heading set at the
top of the page. Every page needs a heading, or Nesta goes pop. The error
message could be more useful...
The code that's blowing at line 288 of models.rb says:
x.heading.downcase <=> y.heading.downcase
Re: [nesta] list files in directory
- From:
- Chris Malek
- Date:
- 2011-10-04 @ 16:31
Doh! You are correct, missing an h1 tag. Thanks again.