Reserved words

I’ve seen this topic has been discussed a couple of times. However, I’m
wondering if a method exists in rails to test a name against the
reserved
words listed on the wiki?

Just wanted to check before I write this myself (and type in all of
those
names – including PostgreSQL).

To explain the application:

I’ve written a project that manages ldap data. On a fresh install,
there is
very small interface. Mainly just a System menu with the following
options:

Folders:
This allows to create high level menu items, this is a tree structure
so
you can nest folders to generate sub menus.

Entries:
This defines what the data in the system. You add an entry to a
folder.
It creates tables base of off the user entries with various column type
options. A lot of other stuff here, too much to talk about now. This is
the
bulk of the system. How you create entries defines the lists and edit
screens as well.

LDAP:
A simple config screen for setting up which ldap server you are
working
with and a management area that lists what changes are to be done (with
ability to cancel, etc…).

So, there are no model files for the entries. They are created
dynamically
with the following lib:

module Stone
module Dynamic
class << self
def klass(table_name)
tname = class_name_from_table(table_name)
const_missing(tname)
rescue NameError
define_klass(table_name)
end

  def objeck(table_name)
    klass(table_name).new
  end

  private
    def class_name_from_table(table_name)
      Inflector.camelize(table_name)
    end

    def define_klass(table_name)
      tname = class_name_from_table(table_name)
      class_def = <<-end_eval
        class #{tname} < ActiveRecord::Base
          set_table_name('#{table_name}')
        end
      end_eval
      eval(class_def, TOPLEVEL_BINDING)
      const_get(tname)
    end
end

end
end

I need to somehow validate against reserved words. Any suggestions?
Anything wrong with the Dynamic module?

Sorry for the long post,
andy

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs