Sha256: 2c57ef98ec797e0ae4a6ca89ee5af06d13909f595b01c39c3931a52f81b395e4
Contents?: true
Size: 981 Bytes
Versions: 4
Compression:
Stored size: 981 Bytes
Contents
class RemotesPage < RecordProxyPage # record proxy pages deal with site models (site.model_name). Override the methods it uses # to interact with these models we can edit Remotes (a non site model) def record @record ||= Remote.find(BSON::ObjectId.from_string(params['id'])) end def records @records ||= Remote.all end def new_record Remote.new end def form_for_new_record(options={}, &block) form_for(Remote.new, options, &block) end # a default user is required before any sites or remotes can be created respond_to :get do with :html do if site.default_users.count == 0 response.redirect '/setup' else super() end end with :json do result = record.site_list if result['success'] result['sites'] = result['sites'].reject do |remote_site| Site.exists?(remote_id: remote_site['id']) end end result end end end
Version data entries
4 entries across 4 versions & 1 rubygems