class ResourcesController < ApplicationController # The following is an example of all the configuration fields that can be # tweaked. AutoRest will try to find good defaults for all this, but # sometimes you will have to tweak the confguration by yourself # (specially when changing labels/titles) create_auto_rest do |opt| opt.resource do |resource| resource.singular= "Anything" resource.plural= "I" resource.model= Want resource.name_prefix= "what_i_like_" end # For parent_resources, each element must be a Struct::ARResource with this members: # singular,plural,model,model_name,name_prefix. opt.parent_resources= [] opt.parent_ids= [:a, :b, :c] # For foreing models, hash must contain :foreign_key => ActiveRecordClass # Example: {:resource_id => Resource} opt.foreing_models= {:some_id => :some_model} opt.index_finder= {:ar => :options} opt.exclude_fields do |exclude_fields| exclude_fields.for_index= [:attribute1] exclude_fields.for_new= [:etc] #exclude_fields.for_edit= nil exclude_fields.for_show= [:i] end opt.fields do |fields| fields.for_index= [:attribute1,"Attribute1",:attribute2,"Attribute2",:etc,"Etc"] fields.for_new= [:attribute1,"Attribute1",:attribute2,"Attribute2",:etc,"Etc"] #fields.for_edit= [:attribute1,"Attribute1",:attribute2,"Attribute2",:etc,"Etc"] #fields.for_show= [:attribute1,"Attribute1",:attribute2,"Attribute2",:etc,"Etc"] end opt.hidden_fields= [1, 2, 3] opt.breadcrumbs do |breadcrumbs| breadcrumbs.prefix_controller= "HELLO" breadcrumbs.prefix_label= "BYE" breadcrumbs.plural= "1" breadcrumbs.singular= "2" breadcrumbs.label_new= "3" breadcrumbs.separator= "4" end opt.templates do |templates| templates.index= {:template => :custom1} templates.show= {:template => :custom2} templates.edit= {:template => :custom3} templates.new= {:template => :custom4} templates.search= {:template => :custom5} end # LABELS AutoRest::Labels.defaults.keys.each_with_index do |key, index| opt.labels[key]= "Custom label #{index}" end #opt.exclude_methods= [] opt.only_methods= [:index,:edit] #opt.methods= [:index,:edit] opt.exclude_links= [:update, :back, :new, :create] #opt.only_links= [] #opt.links= [:index,:search,:update,:show,:destroy,:edit,:back,:new,:create] opt.ferret do |ferret| ferret.enabled= true ferret.options= {:what_ever => :i_want, :search_limit => 123} end opt.will_paginate do |will_paginate| will_paginate.enabled= true will_paginate.options= {:what_ever => :i_like} end end end