Skip to content

Latest commit

 

History

History
24 lines (15 loc) · 772 Bytes

manual_sailor_functions.md

File metadata and controls

24 lines (15 loc) · 772 Bytes

###Reference Manual

###Sailor built-in functions Can be used anywhere in a Sailor web application.

####sailor.make_url( route [, params] ) Creates a url for an internal app route depending on friendly url configuration.

  • route: string, controller/action or controller.

  • params: [optional] table, vars and values to be sent via GET.

Example 1: sailor.make_url( 'post/view', {id = 5, title = 'Manual'} )

####sailor.model( model_name ) Creates a sailor model that can be instantiated in objects with :new().

  • model_name: string, model's name. There must be a .lua file with the model's name under /model.

Example 1:

-- In this case there must be a file inside /model called user.lua
local User = sailor.model( 'user' ) 
local u = User:new( )