I know I'm crazy but

I have data in my database that I want processed like rhtml. Can I do that? I'm saving my site content in there, and suddenly thought it would be brilliant to show "<%= "You are logged in as #{@user.username}." %>" and other stuff. Is this possible/easy?

kopf1988 wrote:

I have data in my database that I want processed like rhtml. Can I do that? I'm saving my site content in there, and suddenly thought it would be brilliant to show "<%= "You are logged in as #{@user.username}." %>" and other stuff. Is this possible/easy?

It is possible. See the Globalize plugin for details on how to do it.

Is there an... easier way to do it? Installing plugins is a pain on shared hosts.

No it's not. Go into your Rails directory and run:

    script/plugin install http://www.yourrepos.com/plugin_directory

Plugins are local to your Rails application directory so being on shared hosting shouldn't affect them at all.

--Jeremy

No command line access...

Besides, Globalization is something that has features absolutely trivial to my purpose. Isn't there something specific to that? I really hate to install a bunch of stuff just to get one tiny little feature out of it.

kopf1988 wrote:

Is there an... easier way to do it? Installing plugins is a pain on shared hosts.

On Jan 19, 9:13 pm, James Byrne <rails-mailing-l...@andreas-s.net>

I was not suggesting that you use Globalize, only that if you wish to see how a database driven user interface is implemented then this is the most comprehensive example for Rails that I am aware of. You can examine it to determine how various features are enabled in code and then adopt/adapt whatever parts you deem meet your specific desires.

At a minimum you must wrap all application text strings that are presented to the user in some form of method that will perform the lookup and return from the database backend.

Right, right. But rails doesn't come with something simple like this??

render :rhtml => "Text string. <%= @something.words %>"

Hmmm... maybe they won't be so hard then, I'll have to try.

Oh, and I found the answer!!!

render :inline

Unless that's a bad idea, lol, but it's just going to be used to render my webpages layouts which I can handily store in the database now.

Just remember, doing this means that someone will have an easy way to executing arbitrary ruby code on your website in case they get access to the database.

(Which is, of course, a major security flaw).

whats wrong with

render :text => "Text string. " + @something.words