class
Amber::Controller::Base
- Amber::Controller::Base
- Reference
- Object
Overview
Patch the Base controller to include Schema integration
Included Modules
- Amber::Controller::Callbacks
- Amber::Controller::Helpers::AssetHelpers
- Amber::Controller::Helpers::CSRF
- Amber::Controller::Helpers::FormHelpers
- Amber::Controller::Helpers::I18n
- Amber::Controller::Helpers::MarkdownHelper
- Amber::Controller::Helpers::NumberHelpers
- Amber::Controller::Helpers::Redirect
- Amber::Controller::Helpers::Render
- Amber::Controller::Helpers::Responders
- Amber::Controller::Helpers::Route
- Amber::Controller::Helpers::TagHelpers
- Amber::Controller::Helpers::TextHelpers
- Amber::Controller::Helpers::URLHelpers
- Amber::Controller::SchemaIntegration
- Amber::DSL::Callbacks
- Amber::Schema::ControllerIntegration
Direct Known Subclasses
Defined in:
amber/controller/base.cramber/controller/schema_integration.cr
Constructors
Instance Method Summary
- #client_ip(*args, **options)
- #client_ip(*args, **options, &)
- #cookies(*args, **options)
- #cookies(*args, **options, &)
- #delete?(*args, **options)
- #delete?(*args, **options, &)
- #filters : Filters
- #filters=(filters : Filters)
- #flash(*args, **options)
- #flash(*args, **options, &)
- #format(*args, **options)
- #format(*args, **options, &)
- #get?(*args, **options)
- #get?(*args, **options, &)
- #halt!(*args, **options)
- #halt!(*args, **options, &)
- #head?(*args, **options)
- #head?(*args, **options, &)
- #patch?(*args, **options)
- #patch?(*args, **options, &)
- #port(*args, **options)
- #port(*args, **options, &)
- #post?(*args, **options)
- #post?(*args, **options, &)
- #put?(*args, **options)
- #put?(*args, **options, &)
- #request(*args, **options)
- #request(*args, **options, &)
-
#request_data : Hash(String, JSON::Any) | Nil
Instance property to store validated request data
-
#request_data=(request_data : Hash(String, JSON::Any) | Nil)
Instance property to store validated request data
- #requested_url(*args, **options)
- #requested_url(*args, **options, &)
- #response(*args, **options)
- #response(*args, **options, &)
- #route(*args, **options)
- #route(*args, **options, &)
-
#route_path(name : Symbol, **params) : String
Named route path helper - generates a path string for the given named route.
-
#route_url(name : Symbol, **params) : String
Named route URL helper - generates a full URL for the given named route.
- #run_after_filter(action)
-
#run_before_filter(action)
TODO Find a way to make these protected again.
- #session(*args, **options)
- #session(*args, **options, &)
-
#validation_result : Amber::Schema::LegacyResult | Nil
Store validation result
-
#validation_result=(validation_result : Amber::Schema::LegacyResult | Nil)
Store validation result
- #valve(*args, **options)
- #valve(*args, **options, &)
- #websocket?(*args, **options)
- #websocket?(*args, **options, &)
Macros inherited from module Amber::DSL::Callbacks
after_action
after_action,
before_action
before_action
Instance methods inherited from module Amber::Controller::Helpers::MarkdownHelper
render_markdown(source : String, options : Amber::Markdown::Options = Amber::Markdown::Options.new) : Stringrender_markdown(*, file : String, options : Amber::Markdown::Options = Amber::Markdown::Options.new) : String render_markdown
Instance methods inherited from module Amber::Controller::Helpers::AssetHelpers
favicon_tag(path : String = "/favicon.ico") : String
favicon_tag,
image_tag(src : String, **attrs) : String
image_tag,
javascript_include_tag(path : String, **attrs) : String
javascript_include_tag,
stylesheet_link_tag(path : String, **attrs) : String
stylesheet_link_tag
Instance methods inherited from module Amber::Controller::Helpers::URLHelpers
button_to(text : String, url : String, method : String = "POST", **attrs) : String
button_to,
link_back(text : String = "Back", **attrs) : String
link_back,
link_to(text : String, url : String, **attrs) : String
link_to,
mail_to(email : String, text : String | Nil = nil, **attrs) : String
mail_to
Instance methods inherited from module Amber::Controller::Helpers::FormHelpers
checkbox(name : String, checked : Bool = false, **attrs) : String
checkbox,
email_field(name : String, value : String | Nil = nil, **attrs) : String
email_field,
form_for(action : String, method : String = "POST", **attrs, &block : -> String) : String
form_for,
hidden_field(name : String, value : String) : String
hidden_field,
label(for_field : String, text : String | Nil = nil, **attrs) : String
label,
number_field(name : String, value : Number | Nil = nil, **attrs) : String
number_field,
password_field(name : String, **attrs) : String
password_field,
radio_button(name : String, value : String, checked : Bool = false, **attrs) : String
radio_button,
select_field(name : String, options : Array, selected : String | Nil = nil, **attrs) : String
select_field,
submit_button(text : String = "Submit", **attrs) : String
submit_button,
text_area(name : String, value : String | Nil = nil, **attrs) : String
text_area,
text_field(name : String, value : String | Nil = nil, **attrs) : String
text_field
Instance methods inherited from module Amber::Controller::Helpers::NumberHelpers
number_to_currency(number : Number, unit : String = "$", precision : Int32 = 2) : String
number_to_currency,
number_to_human_size(bytes : Number) : String
number_to_human_size,
number_to_percentage(number : Number, precision : Int32 = 1) : String
number_to_percentage,
number_with_delimiter(number : Number, delimiter : String = ",") : String
number_with_delimiter
Instance methods inherited from module Amber::Controller::Helpers::TextHelpers
escape_html(text : String) : String
escape_html,
highlight(text : String, phrase : String, tag : String = "mark") : String
highlight,
pluralize(count : Int32, singular : String, plural : String | Nil = nil) : String
pluralize,
simple_format(text : String) : String
simple_format,
strip_tags(html : String) : String
strip_tags,
truncate(text : String, length : Int32 = 30, omission : String = "...") : String
truncate,
word_wrap(text : String, line_width : Int32 = 80) : String
word_wrap
Instance methods inherited from module Amber::Controller::Helpers::TagHelpers
content_tag(tag_name : String, content : String | Nil = nil, **attrs, &block : -> String) : Stringcontent_tag(tag_name : String, content : String | Nil = nil, **attrs) : String content_tag, tag(tag_name : String, **attrs) : String tag
Instance methods inherited from module Amber::Controller::Helpers::I18n
l(*arg)
l,
t(*arg)
t
Instance methods inherited from module Amber::Controller::Helpers::Route
action_name
action_name,
controller_name
controller_name,
controller_name_no_underscore
controller_name_no_underscore,
route_resource
route_resource,
route_scope
route_scope
Instance methods inherited from module Amber::Controller::Helpers::Responders
set_response(body, status_code = 200, content_type = Content::TYPE[:html])
set_response
Macros inherited from module Amber::Controller::Helpers::Render
render(template = nil, layout = true, partial = nil, path = "src/views", folder = __FILE__)
render
Instance methods inherited from module Amber::Controller::Helpers::Redirect
redirect_back(**args)
redirect_back,
redirect_to(controller : Symbol | Class, action : Symbol, **args)redirect_to(location : String, **args)
redirect_to(action : Symbol, **args) redirect_to
Instance methods inherited from module Amber::Controller::Helpers::CSRF
csrf_metatag
csrf_metatag,
csrf_tag
csrf_tag,
csrf_token
csrf_token
Instance methods inherited from module Amber::Schema::ControllerIntegration
render_validated(data : Hash(String, JSON::Any), status : Int32 = 200)
render_validated,
respond_with(data : Hash(String, JSON::Any) | NamedTuple | Nil = nil, status : Int32 = 200, schema_name : String | Nil = nil)
respond_with,
respond_with_error(message : String, status : Int32 = 400, code : String | Nil = nil)
respond_with_error,
respond_with_errors(errors : Array(Amber::Schema::Error), status : Int32 = 422)
respond_with_errors,
validate_request(schema_name : String | Nil = nil) : Amber::Schema::LegacyResult
validate_request,
validate_response(data : Hash(String, JSON::Any), status : Int32 = 200, schema_name : String | Nil = nil) : Amber::Schema::LegacyResult
validate_response,
validated_params : Hash(String, JSON::Any) | Nil
validated_params,
validation_failed? : Bool
validation_failed?
Macros inherited from module Amber::Schema::ControllerIntegration
auto_validate
auto_validate,
response_schema(action, &block)
response_schema,
schema(action, &block)
schema,
validate_schema(action = nil, required = true)
validate_schema
Constructor Detail
Instance Method Detail
Instance property to store validated request data
Instance property to store validated request data
Named route path helper - generates a path string for the given named route.
Named route URL helper - generates a full URL for the given named route.
def validation_result=(validation_result : Amber::Schema::LegacyResult | Nil)
#
Store validation result