Changeset 1228 for trunk/README
- Timestamp:
- 01/09/08 11:45:24 (11 months ago)
- Files:
-
- trunk/README (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/README
r1224 r1228 104 104 105 105 To use your choice ORM, install the appropriate gem and uncomment the appropriate +use_orm+ line in 106 M ERB_ROOT/config/dependencies.rb106 Merb.root/config/dependencies.rb 107 107 108 108 === Controllers 109 109 110 (M ERB_ROOT/app/controllers/*)110 (Merb.root/app/controllers/*) 111 111 112 112 Merb controllers inherit from Merb::Controller and contain built in view/template rendering. … … 118 118 you are going to want to end your functions with a call to +render+. By default, +render+ will 119 119 render the view template associated with your action (in default merb that would be 120 M ERB_ROOT/app/views/<controller>/<action>.html.erb - see the View section for more info.)121 122 Controllers can be generated by calling M ERB_ROOT/script/generate controller ControllerName.123 By default, generated controllers inherit from the Application class (M ERB_ROOT/app/controllers/application.rb)120 Merb.root/app/views/<controller>/<action>.html.erb - see the View section for more info.) 121 122 Controllers can be generated by calling Merb.root/script/generate controller ControllerName. 123 By default, generated controllers inherit from the Application class (Merb.root/app/controllers/application.rb) 124 124 which itself inherits from Merb:Controller. Application is a good place to put code pertinent to all controllers. 125 125 An example would be setting a filter to check if a user is logged in or to preload user data for each controller. … … 179 179 === Views 180 180 181 (M ERB_ROOT/app/views/*)181 (Merb.root/app/views/*) 182 182 183 183 A view can be loosely defined as any data sent back to the client (a "view" of your data.) … … 186 186 By default, a call to +render+ without any options renders the view template associated 187 187 with that controller action. Using the default ERB templating system, this means that a 188 call to +render+ in Posts#index would render the file M ERB_ROOT/app/views/posts/index.html.erb188 call to +render+ in Posts#index would render the file Merb.root/app/views/posts/index.html.erb 189 189 190 190 ==== Layouts 191 191 192 (M ERB_ROOT/app/views/layout/*)192 (Merb.root/app/views/layout/*) 193 193 194 194 Layouts are generic templates in which your specific view templates are rendered. A sample … … 206 206 207 207 By default, +render+ will look for a corresponding layout for your controller in the form 208 of M ERB_ROOT/app/views/layout/<controller>.html.erb . If no specific layout is present,209 +render+ will attempt to use M ERB_ROOT/app/view/layout/application.html.erb208 of Merb.root/app/views/layout/<controller>.html.erb . If no specific layout is present, 209 +render+ will attempt to use Merb.root/app/view/layout/application.html.erb 210 210 211 211 <i>See #render for more details/options, as well as how to use different templating systems … … 230 230 === Helpers 231 231 232 (M ERB_ROOT/app/helpers/*)232 (Merb.root/app/helpers/*) 233 233 234 234 app/helpers/global_helper.rb will be available to all of your views. … … 242 242 def upload 243 243 puts params[:file].inspect 244 FileUtils.mv params[:file][:tempfile].path, M ERB_ROOT+"/uploads/#{params[:file][:filename]}"244 FileUtils.mv params[:file][:tempfile].path, Merb.root+"/uploads/#{params[:file][:filename]}" 245 245 render 246 246 end
