· 1 min read
Screencast: ERB Blöcke in Rails 3
Download:
Download (21.2 MB, 9:41) Alternativer Download für iPod & Apple TV (18 MB, 9:41)
Resourcen:
Quellcode:
[bash] rvm install ruby-head rvm ruby-head gem install rails —pre bundle install [/bash]
[ruby] # Gemfile gem “rails”, “3.0.0.beta2”
# application_helper.rb def admin_area(&block) content = with_output_buffer(&block) content_tag(:div, content, :class => “admin”) end # or def admin_area(&block) content_tag(:div, :class => “admin”, &block) if admin? end [/ruby]
[html] <%= form_for @product do |f| %> <% end %>
<%= div_for @product do %> <% end %>
<% @comments.each do |c| %> <% end %>
<% content_for :side do %> <% end %>
<% cache do %> <% end %>
<%= admin\_area do %> <%= link\_to "Edit", edit\_product\_path(@product) %> | <%= link\_to "Destroy", @product, :confirm => "Are you sure?", :method => :delete %> | <%= link\_to "View All", products\_path %> <% end %> \[/html\]