RubyGems Navigation menu

trestle_generator 1.0.0

The name of this RubyGem points out that nobody intentionally sends a train across a gorge with nothing but a scaffold to support it. That’s what a trestle is for! Why use the trestle generator instead of the scaffold generator? The trestle generator produces code that is closer to production-quality in two respects: SAFETY The trestle generator uses the HTTP POST method for actions that change data. Well-behaved web applications protect themselves against errant HTTP GET requests (such as come from Google Web Accelerator and the like). The scaffold generator fails to do this. USABILITY The trestle generator produces controllers with just four actions (index, new, edit, and destroy). Controllers produced by the scaffold generator have eight actions. Fewer actions exposed to the outside world is better if the behavior of these actions is in line with the semantics of HTTP GET and HTTP POST. The net effect is that you will not have to throw away or tweak as much trestle-generated code as you do scaffold-generated code. Less work for you means your application gets built sooner. Tobias Lütke’s postback_generator RubyGem has the same idea. The scaffold generator produces a controller with the following public interface for a database table named ‘people’: /people - lists existing person records /people/list - lists existing person records /people/new - shows an empty person form /people/create - creates a new person record from request parameters /people/show/99 - shows the person record having ID 99 /people/edit/99 - shows a person form for the person record having ID 99 /people/update/99 - updates the person record having ID 99 using request parameters /people/destroy/99 - deletes the person record having ID 99, even for HTTP GET! Contrast this with the public interface produced by the trestle generator: /people - lists existing person records /people/new - HTTP GET shows an empty person form; HTTP POST creates a new person record from request parameters /people/99 - shows the person record having ID 99 /people/99/edit - HTTP GET shows a person form for the person record having ID 99; HTTP POST updates the person record having ID 99 using request parameters /people/99/destroy - HTTP GET redirects to /people/99/edit with a notice that the user must click the form’s Destroy button to destroy a record; HTTP POST deletes the person record having ID 99 after prompting the user for confirmation Notice the hierarchical nature of trestle URLs. Because the ID comes before the verb, there are fewer illegal variations that with scaffold URLs. This encourages the user to use the Up One Level button on the Google Toolbar that clips one element off the end of the current URL. Scaffold URLs do not play nicely with the Up One Level button.

Gemfile:
=

インストール:
=

バージョン履歴:

  1. 1.1.7.3 August 17, 2006* (11.5KB)
  2. 1.1.7.2 August 02, 2006* (11.5KB)
  3. 1.1.7.1 July 19, 2006* (11.5KB)
  4. 1.1.7 July 01, 2006* (11.5KB)
  5. 1.1.6 June 26, 2006* (10.5KB)
  6. 1.0.0 January 03, 2006* (9.5KB)
全てのバージョンを表示(全13件)

Runtime依存関係 (1):

rails >= 1.0.0

所有者:

作者:

  • Nils Jonsson

SHA 256チェックサム:

=

累計ダウンロード数 85,149

このバージョンのみ 14,331

このバージョンがリリースされたのは:

ライセンス:

N/A

必要なRubyのバージョン: > 0.0.0

必要なRubyGemsのバージョン:

リンク: