Skip to content

Instantly share code, notes, and snippets.

__________________ _-_
\________________|)____.---'---`---.____
|| \----._________.----/
|| / ,' `---'
___||_,--' -._
/___ ||(-
`---._____-'
class TicketType < Struct.new(:name)
extend ActiveModel::Naming
include ActiveModel::Conversion
extend ActiveModel::Translation
def initialize(*args)
super
end
def persisted=(boolean)
From 0256c11df521fc07768f0b1b307e9231e4c46ed8 Mon Sep 17 00:00:00 2001
From: Ben Mills <[email protected]>
Date: Fri, 17 Dec 2010 19:01:14 -0700
Subject: [PATCH] Titleize model_name for default submit button value
---
actionpack/lib/action_view/helpers/form_helper.rb | 4 ++-
actionpack/test/lib/controller/fake_models.rb | 22 +++++++++++++++++++++
actionpack/test/template/form_helper_test.rb | 20 ++++++++++++++++++-
3 files changed, 44 insertions(+), 2 deletions(-)
if object.class.respond_to?(:model_name)
object.class.model_name.human
else
@object_name.to_s.humanize
end.titleize
class ToHaml
def initialize(path)
@path = path
end
def convert!
Dir["#{@path}/**/*.erb"].each do |file|
`html2haml -rx #{file} #{file.gsub(/\.erb$/, '.haml')}`
end
end
namespace :accounts do
namespace :admin do
root :to => "base#index"
end
end
resources :accounts do
namespace :admin do
resources :roots
end
end
$(document).ready(function() {
$('#my-element').flash();
});
And that project has a ticket:
| title | description | type |
| Standards compliance | Isn't a joke. | Bug |
Factory.define :project do |project|
project.name :name
project.customer { |c| c.association(:customer) }
project.project_type { |t| t.association(:project_type) }
end