Friday, March 09, 2007

About Action

Action:The purpose of an action is to stuff data into Ruby variables that the ERb code in the view file canunstuff and display. So, we need to anticipate what data the view will need.

Both the work show action and the edition show action will utilize a common Rails idiom: grabbing the value of the CGI variable id and using it as an index to find the correct instance of the relevant entity. In other words, if you’re in the work controller, performing the show action, and the value of the CGI variable id is 2, then you want to show the work that’s indexed as 2. Exactly what indexed means(how the number translates into which work is produced) is up to the model. But in the typical case, 2 will be treated as the value of the id field in the appropriate database table.

No comments: