This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def content_navigation | |
content_for :content_navigation do | |
render :partial => 'navigation' | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mbc::Application.routes.draw do | |
resources :fidelity_bonds do | |
resources :edits | |
member do | |
get :edit_principal | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FidelityBondPrincipalAddressUpdatesController < CommandsController | |
filter_resource_access :additional_member => [ :execute ] | |
before_filter :set_updated_by | |
def after_execute_path | |
command.receiver | |
end | |
def after_execute_flash_message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Feed | |
def page | |
@page ||= get_url | |
end | |
def posts | |
@posts ||= do | |
post_nodes.map do |post_node| | |
build_post(post_node) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FactoryMonitor.benchmarks = [] | |
FactoryMonitor.stack = [] | |
def run_with_monitor | |
self.class.stack.push self.class.benchmarks | |
self.class.benchmarks = child_results = [] | |
results = Benchmark.get | |
self.class.benchmarks = self.class.stack.pop | |
self.class.benchmarks << [factory_name, results, child_results] | |
end |
OlderNewer