It is indeed possible use ActiveRecord (or other ORMs or database libraries) in combination with nanoc, but there is one thing you need to be aware of. nanoc perform dependency tracking between Nanoc3::Items generated by data sources, and it cannot know whether arbitrary data will have changed and necessitates a recompilation of the site. nanoc also assumes all helper functions are pure, meaning that the return value is in function of the input parameters (actual parameters as well as @item, @layout etc).
For example, if you were to put the results of a raw SQL query somewhere on an item or a layout (e.g. <%= sql('SELECT title FROM posts').join %>) and you compile once, then change the “posts” table and recompile, nanoc will not recompile that page a second time, because it has no way of knowing that the posts table has changed. Similarly, don’t include file contents read directly off the disk (e.g. <%= YAML.load_file('translations.yml')['my_trans_key']['en'] %>.
The recommended approach to using external data is to write a data source for them and wrap them in Nanoc3::Items.
Cheers,
Denis
> --
> You received this message because you are subscribed to the nanoc discusssion group.
>
> To post to this group, send email to na...@googlegroups.com
> To unsubscribe from this group, send email to
> nanoc+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nanoc?hl=en
I created an example of how ActiveRecord (or other ORMs) could be used together with nanoc. You can find it here:
https://github.com/ddfreyne/nanoc-activerecord-example
Cheers,
Denis
> > nanoc+un...@googlegroups.com
> > For more options, visit this group at
> > http://groups.google.com/group/nanoc?hl=en
>
>
>
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the nanoc discusssion group.
>
> To post to this group, send email to na...@googlegroups.com
> To unsubscribe from this group, send email to
> nanoc+un...@googlegroups.com
--
--
You received this message because you are subscribed to the nanoc discusssion group.
To post to this group, send email to na...@googlegroups.com
To unsubscribe from this group, send email to
nanoc+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nanoc?hl=en
---
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.
For more options, visit https://groups.google.com/groups/opt_out.