I was wondering if anyone had an opinion on how to do file includes in
RoR. I am currently doing it with JavaScript.
I am building a CMS for a dynamic website. I want a tool that lets
non-programmers build a website by filling out some forms, making some
choices (templates, images, etc..), and previewing the page before
publishing it.
The tool should take the info from the CMS forms and populate modules
(mini web pages) that will then make-up the website. I plan on building
the final webpage by including the modules in the template.
So anyways, what's the Ruby way to do includes?
Code and pointers to tutorials are always helpful.
The very same thing that bothers me in ruby. We can do this “include” very easily in PHP. And I can’t seem to find the same method to “include” in ruby.
As for rails, maybe you can try using render_component, like me. I use render_component to include modules (as in joomla) in pages. Or using helpers to generate components and modules (as in joomla).
I admit that this seem kind of messy… But I can’t think of any other way right now… ~_~
The very same thing that bothers me in ruby. We can do this "include" very
easily in PHP. And I can't seem to find the same method to "include" in
ruby.
Bear in mind that PHP's include functionality has two purposes - 1)
including other source code - the Ruby equivalent of this is require.
2) Including templates within templates (like server-side includes) -
the reason PHP makes this easy is because it was originally designed as
a templating language. Ruby wasn't therefore the whole concept of SSIs
in Ruby wouldn't make sense. In Rails, this is what partials are for.