Class: MagicLamp::FixturesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/magic_lamp/fixtures_controller.rb

Constant Summary collapse

ERRORS =
[
  MagicLamp::ArgumentError,
  MagicLamp::AlreadyRegisteredFixtureError,
  MagicLamp::AmbiguousFixtureNameError,
  MagicLamp::UnregisteredFixtureError,
  MagicLamp::AttemptedRedirectError,
  MagicLamp::DoubleRenderError
].map(&:name)
RENDER_TYPE =
Rails::VERSION::MAJOR >= 5 ? :plain : :text

Instance Method Summary collapse

Instance Method Details

#indexObject



27
28
29
# File 'app/controllers/magic_lamp/fixtures_controller.rb', line 27

def index
  render json: MagicLamp.generate_all_fixtures
end

#showObject



22
23
24
25
# File 'app/controllers/magic_lamp/fixtures_controller.rb', line 22

def show
  MagicLamp.load_lamp_files
  render RENDER_TYPE => MagicLamp.generate_fixture(params[:name])
end