Support for Http Method attributes

30 views
Skip to first unread message

Guru Kathiresan

unread,
Oct 17, 2010, 5:16:26 AM10/17/10
to Delphi on Rails
Hello,
I have added support for setting the Http Method as an attribute for
the action functions instead of suffixing _get or _post. With the new
change the Controller class might look like this :

type
TBlogController = class(TApplicationController)
public
[HttpGet]
procedure Index(out data: ISuperObject);
[HttpPost]
procedure New(const data: TBlog);
procedure View(id: Integer; out data: ISuperObject);
procedure Edit(id: Integer; out data: ISuperObject);overload; {If
no attribute is not specified, it will default to HttpGet}
[HttpPost]
procedure Edit(const data: TBlog);overload;
[HttpPost]
procedure Delete(id: Integer);
end;

This is similar to that of ASP.NET MVC style. The change also retains
the old style of action reference to maintain backward compatibility.

Please check the changes at :

http://twinforms.com/downloads/attribute_support_changes.zip

Thanks,
Guru Kathiresan

Henri Gourvest

unread,
Oct 17, 2010, 5:56:28 AM10/17/10
to delphi...@googlegroups.com
Hi,

Superobject.pas is not the place to personalize Delphi on Rails.
To do it, create a class that inherit from TActionController, for example TApplicationController.
Override the Invoke method and inherit all your new controllers from this new class.
The virtual Invoke method is provided for this purpose.

regards

Henri


2010/10/17 Guru Kathiresan <gkat...@yahoo.com>
Reply all
Reply to author
Forward
0 new messages