Skip to content

Instantly share code, notes, and snippets.

# routes.rb
resources :fidelity_bonds do
resources :edits
member do
get :edit_principal
end
end
# app/views/fidelity_bonds/edit_principal.html.haml
= simple_form_for @fidelity_bond, :url => fidelity_bond_edits_path(@fidelity_bond) do |f|
def status
return "pending" if effective_date > Date.today
if cancellation_date
cancellation_date <= Date.today ? "cancelled" : "pending_cancellation"
else
if expiration_date <= Date.today
renew ? "renewed" : "expired"
else
"in_force"
end
@ryanhanks
ryanhanks / Gemfile.lock
Created March 1, 2011 04:28
Gemfile.lock
GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
actionmailer (3.0.4)
actionpack (= 3.0.4)
mail (~> 2.2.15)
actionpack (3.0.4)
activemodel (= 3.0.4)
activesupport (= 3.0.4)
<h1>Promotional Merchandise Request</h1>
<h2>Available Items</h2>
<% form_for @order do |order_form| %>
<table>
<% order_form.fields_for :line_items do |line_item_form| %>
<% product = line_item_form.object.product %>
<%= line_item_form.hidden_field :product_id %>
<tr>
<td><%= image_tag product.image.url %></td>
<td><%= product.name %></td>
Here is an example of how I use it in my a view (new.html.erb):
<% content_navigation %>
<%= render :partial => 'form' %>
==========
This is my application helper:
module ApplicationHelper
def content_navigation
content_for :content_navigation do
render :partial => 'navigation'
end
end