0

Assume I have a running ruby on rails app. I’m creating classes (db-models) defined by a description provided at runtime.

Right now, I’m using the rails app (via browser) to trigger the code generation — and therefore the app “knows” about its new classes.

But, is it possible to inject code from scripts executed inside the rails app directory?
Like…

$ [path/to/app] rails s   
$ [path/to/app] script/apply_schema 
Johannes
  • 55
  • 4

1 Answers1

0

Since RoR supports many helpers for both generating tables, columns etc. I do not see why you want to do this using script injection. this would not only be a very weird way of inputting and rendering data but it would also create quite a security risk.

Then comes my second question (in runtime) how would you define authentication? since you are trying to inject code?

I would advise using the SQL helpers to create/update/destroy attributes. this is based on a much used and effective architecture. also using relations makes you able to build quite alot while still remaining in the "safe" environment RoR offers.

If you want to try a framework wich offers data injection on runtime try Meteor

dennis
  • 2,000
  • 18
  • 26
  • Hi, thanks for your answer. But I don’t want to display data using this technique. I want to create classes (for db-models, …) at runtime and use them in the running app. – Johannes May 09 '12 at 09:46
  • … and being an academic prototype, authentication is verified by access to the machine. :) – Johannes May 09 '12 at 09:49