##Refs
Add to Gemfile: gem 'wicked_pdf'
<%= form_for(@stake) do |f| %> | |
<% if @stake.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@stake.errors.count, "error") %> prohibited this stake from being saved:</h2> | |
<ul> | |
<% @stake.errors.full_messages.each do |message| %> | |
<li><%= message %></li> | |
<% end %> | |
</ul> |
##Refs
Add to Gemfile: gem 'wicked_pdf'
def create | |
erros = [] | |
variants = [] | |
ProductionLabel.transaction do | |
begin | |
label = ProductionLabel.create!(params[:production_labels]) | |
unless (label.valid?) | |
raise label.errors.full_messages | |
end | |
class Utf8Header < Thor | |
desc "add", "Add Content UTF-8 on top of all .rb/.feature files" | |
# copy & pasted from https://gist.github.com/738245 | |
def add | |
files = Array.new | |
["*.rb", "*.rake","*.feature"].each do |extension| | |
files.concat(Dir[ File.join(Dir.getwd.split(/\\/), "**", extension) ]) | |
end | |
files.each do |file| |
# add this file as config/initializers/will_paginate_postgresql_count.rb | |
# in a Rails application | |
module WillPaginate | |
module Finder | |
module ClassMethods | |
# add '1=1' to paginate conditions as marker such that the select from the pg_class | |
# is used to approximate simple rows count, e.g. | |
# Foo.paginate(:page => params[:page], :conditions => "1=1") |
module MultiParameterAttributes | |
def filter_time(attributes, name) | |
attrs = attributes.collect do |key, value| | |
if key =~ /^#{Regexp.escape(name.to_s)}\((\d+)(\w)\)$/ | |
[$1.to_i, value.send("to_#$2")] | |
end | |
end.compact.sort_by(&:first).map(&:last) | |
Time.zone.local(*attrs) unless attrs.empty? | |
end |
class Address | |
include Mongoid::Document | |
belongs_to :user, :inverse_of => :addresses | |
belongs_to :venue, :inverse_of => :venues | |
field :street, :type => String | |
field :city, :type => String | |
field :state, :type => String | |
field :zip, :type => Integer |
file 'Gemfile', <<-GEMS | |
source 'http://gemcutter.org' | |
gem "rails", "3.0.0.beta3" | |
gem "bson_ext" | |
gem "mongoid", "2.0.0.beta4" | |
gem "haml", "3.0.0.rc.2" | |
gem "compass", "0.10.0.rc4" | |
gem "inherited_resources" | |
group :test do |
#!/bin/bash | |
# run with: curl -s http://gist.github.com/265272.txt | bash | |
set -e | |
localdir=$HOME/.mongodb | |
datadir=$localdir/data | |
conf=$localdir/mongod.conf | |
agentdir=$HOME/Library/LaunchAgents | |
agent=$agentdir/org.mongodb.mongod.plist |
Rails CMS alternatives | |
====================== | |
Active projects: | |
--------------- | |
adva-cms | |
repo: http://github.com/svenfuchs/adva_cms/ | |
site: http://adva-cms.org/ | |
Last update: 11/24/09 | |
"the cutting edge Rails CMS platform" |