Module: RestRails

Defined in:
lib/rest_rails.rb,
lib/rest_rails/error.rb,
lib/rest_rails/engine.rb,
lib/rest_rails/version.rb,
app/helpers/rest_rails/application_helper.rb,
app/controllers/rest_rails/data_controller.rb,
lib/generators/rest_rails/install_generator.rb,
app/controllers/rest_rails/application_controller.rb

Defined Under Namespace

Modules: ApplicationHelper, Generators Classes: ApplicationController, DataController, Engine, Error

Constant Summary collapse

VERSION =
'1.1.11'

Class Method Summary collapse

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (RestRails)

    the object that the method was called on



12
13
14
# File 'lib/rest_rails.rb', line 12

def self.configure
  yield self
end

.path_for(ar_obj) ⇒ Object



16
17
18
19
20
21
# File 'lib/rest_rails.rb', line 16

def self.path_for(ar_obj)
  root_path = RestRails::Engine.mounted_path
  table = ar_obj.class.table_name
  return "#{root_path}/#{table}" if ar_obj.id.nil?
  return "#{root_path}/#{table}/#{ar_obj.id}"
end