module ScaffoldingExtensions

  1. lib/scaffolding_extensions.rb
  2. lib/scaffolding_extensions/controller.rb
  3. lib/scaffolding_extensions/controller/action_controller.rb
  4. lib/scaffolding_extensions/controller/camping.rb
  5. lib/scaffolding_extensions/controller/rack.rb
  6. lib/scaffolding_extensions/controller/ramaze.rb
  7. lib/scaffolding_extensions/controller/sinatra.rb
  8. lib/scaffolding_extensions/helper.rb
  9. lib/scaffolding_extensions/jquery_helper.rb
  10. lib/scaffolding_extensions/meta_controller.rb
  11. lib/scaffolding_extensions/meta_model.rb
  12. lib/scaffolding_extensions/model.rb
  13. lib/scaffolding_extensions/model/active_record.rb
  14. lib/scaffolding_extensions/model/datamapper.rb
  15. lib/scaffolding_extensions/model/sequel.rb
  16. lib/scaffolding_extensions/overridable.rb
  17. lib/scaffolding_extensions/prototype_helper.rb
  18. lib/scaffolding_extensions/rails_test_help.rb
  19. show all

This is the base module for the plugin. It has some constants that can be changed:

If you include the contents of auto_complete.css in your stylesheet, set “auto_complete_skip_style = true”, so the stylesheet isn't added for every autocompleting text box.

Scaffolding Extensions attempts to determine which framework/ORM you are using and load the support for it (if it is supported).

Constants

AUTO_COMPLETE_CSS = <<-END END  
DEFAULT_ACTION = :browse  
DEFAULT_METHODS = [:manage, :show, :delete, :edit, :new, :search, :merge, :browse]  
MODEL_SUPERCLASSES = []  
ROOT = File.dirname(File.dirname(__FILE__))  
TEMPLATE_DIR = File.join(ROOT, "scaffolds")  

Public Instance methods

all_models (options={})

Takes two options, :only and :except. If :only is given, :except is ignored. Either can contain model classes or underscored model name strings.

[show source]
# File lib/scaffolding_extensions.rb, line 57
def all_models(options={})
  return @all_models if @all_models
  if options[:only]
    Array(options[:only]).collect{|f| f.is_a?(String) ? f.camelize.constantize : f}
  else
    string_except, except = Array(options[:except]).partition{|f| f.is_a?(String)}
    model_files.collect{|file|File.basename(file).sub(/\.rb\z/, '')}.
     reject{|f| string_except.include?(f)}.
     map{|f| f.camelize.constantize}.
     reject{|m| except.include?(m) || !MODEL_SUPERCLASSES.any?{|klass| m.ancestors.include?(klass)}}
  end
end
auto_complete_css ()

The stylesheet for the autocompleting text box, or the empty string if ::auto_complete_skip_style is true.

[show source]
# File lib/scaffolding_extensions.rb, line 72
def auto_complete_css
  auto_complete_skip_style ? '' : AUTO_COMPLETE_CSS
end
javascript_library= (jslib)

The javascript library to use (defaults to JQuery, can be set to 'Prototype')

[show source]
# File lib/scaffolding_extensions.rb, line 77
def javascript_library=(jslib)
  require "scaffolding_extensions/#{jslib.downcase}_helper"
  ScaffoldingExtensions::Helper.send(:include, const_get("#{jslib}Helper"))
end