Sequel Model Dependencies

19 views
Skip to first unread message

f.ric...@gmail.com

unread,
Aug 15, 2019, 3:11:47 PM8/15/19
to nanoc
I'm in an unfortunate situation where something I developed with nanoc as a proof-of-concept several years ago has grown increasingly complex and depended-upon. I'm hoping someone can help me with a dependency issue I don't quite understand.

(Note: at this point, we're still using Nanoc 4.1.6 with legacy identifiers.)

We have a large SQLite database that we use as a datasource. The primary table is less than 1000 rows, but over time, we've added several one-to-many or many-to-many relationships with other tables. I'm using the Sequel gem to create models, and creating nanoc datasources from those models.

I can't share much about the real domain, so here is a toy example that will hopefully illustrate my problem. Imagine I have a Desk table, a DeskItems table, and an Items table.

Originally, I thought all I needed to do was to setup the many_to_many and one_to_many relationships in the Sequel model definitions and only create items from the Desk model, but I started noticing that the parts of the site would not update to reflect changes correctly. If something was changed in Desks and DeskItems, the page for Desk was correctly re-compiled. On the other hand, if the change was only adding or removing a row in DeskItems, nanoc would not detect any changes for the corresponding Desk page.

Now, I'm trying to create items from DeskItems and read them by using @items.find_all("/deskItems/#{desk[:ID}/*").

After this change, I did a test where I added a row to DeskItems and the correct Desk page re-compiled. Then I removed that row I had added, and nanoc did not detect the change.

I changed the path to "/deskItems/#{desk[:ID}/**/*" without changing the database again and the correct Desk page re-compiled.

Then I added the row to DeskItems again, but this time the Desk did not re-compile.

Is there something else I should be doing to make sure the dependencies I expect are recognized by nanoc?

I know I'm being a bit vague, but I'm hoping there might be enough for someone to go on. Happy to try to clarify more if I can.

Thanks in advance,
Frank

Denis Defreyne

unread,
Aug 17, 2019, 4:03:05 AM8/17/19
to na...@googlegroups.com
Hey Frank,

Nanoc 4.1.6 is a rather old release — could you try upgrading to the latest version of Nanoc and see whether the problem persists?

Upgrading within Nanoc 4.x.x should work out of the box. Let me know if it’s not straightforward.

Best,

Denis


--
You received this message because you are subscribed to the Google Groups "nanoc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nanoc+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nanoc/d1b4507a-b157-4b1a-bf6a-b5db0de1b2d8%40googlegroups.com.

f.ric...@gmail.com

unread,
Aug 19, 2019, 11:26:14 AM8/19/19
to nanoc
When I tried updating even to version 4.2, I got errors about identifiers ending with slashes. I have legacy identifiers enabled for all my datasources. I was afraid of breaking something if I went and started modifying all my datasources to remove trailing slashes from their identifiers.

What would you recommend?
> To unsubscribe from this group and stop receiving emails from it, send an email to na...@googlegroups.com.

Denis Defreyne

unread,
Sep 11, 2019, 2:36:40 AM9/11/19
to na...@googlegroups.com
> When I tried updating even to version 4.2, I got errors about identifiers ending with slashes.  I have legacy identifiers enabled for all my datasources.  I was afraid of breaking something if I went and started modifying all my datasources to remove trailing slashes from their identifiers.
>
> What would you recommend?

Hey Frank,

I suspect that you’re calling Nanoc::Identifier.new which generates a non-legacy identifier by default. If you pass type: legacy to the constructor (e.g. Nanoc::Identifier.new('/moo/', type: :legacy)) then that might fix the issue.

(Newer versions of Nanoc 4.x, presumably starting from around 4.2, are more strict in how identifiers are constructed; beforehand, it’d have been possible to construct non-legacy identifiers ending with a slash, which can cause problems.)

If you’re still having issues: do you have the site source available somewhere (on GitHub) so I can take a look?

Denis

To unsubscribe from this group and stop receiving emails from it, send an email to nanoc+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nanoc/2aec5dfd-41f4-4a6e-8c2a-1f23743e1b3e%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages