Skip to content

Instantly share code, notes, and snippets.

@x37v
x37v / scottg1
Created February 26, 2014 18:15
scott g's first guy, updated by xnor.
#N canvas 1140 61 583 661 10;
#X obj 74 -93 phasor~;
#X obj 93 -518 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
1;
#X obj 28 -239 mtof;
#X obj 89 -245 hradio 15 1 0 8 empty empty empty 0 -8 0 10 -1856 -262144
-228856 3;
#X obj 89 -213 + 1;
#X floatatom 158 -215 5 0 0 0 - - -;
#X obj 92 -427 random 8;
resource :contacts, :only => [], :path => 'rsvp' do
get :new
post :create
end
#this is sort of ridiculous, is there a better way?
resource :contacts, :only => [], :path => 'rsvp' do
get :new
get :thank
post :create
end
<div id="edit_user_form" class="blue_fields">
<%= form_for [:admin, @user] do |f| %>
<%= qm_error_messages("account information", @user) %>
<div>
<%= f.check_box :admin %>
<%= f.label :admin, "Is an admin?" %>
</div>
<br />
test "paypal validation helper" do
address = "1 Main St"
zipcode = 95131
emails = %w{
foo_1284577745_per@gmail.com
FOO_1284577745_per@gmail.com
foo_1284577745_per@GMAIL.com
FoO_1284577745_per@GmAiL.Com
FoO_1284577745_per@GmAiL.CoM
def check_username_is_allowed
RESTRICTED_NAMES.each do |restricted|
- errors.add(:username, "is not available") if
- username =~ /#{restricted}/i unless errors.on(:username)
+ errors[:username] << "is not available" if
+ username =~ /#{restricted}/i unless errors[:username] and errors[:username].size != 0
end
end
#in the form
<% if @opportunity.opportunity_filters.size > 0 %>
<% f.fields_for :opportunity_filters do |filter_form| %>
<%= render 'opportunity_filters/edit_form',
:locals => {:foo => @opportunity.opportunity_filters[0], :f => filter_form} %>
<% end %>
<% end %>
#the partial [just for testing, filter_type is an attribute of opportunity_filter]
<%= form_for(@opportunity) do |f| %>
#...
<% f.fields_for :opportunity_filters do |filter_form| %>
<%= render 'opportunity_filters/edit_form',
:collection => @opportunity.opportunity_filters,
:as => :opportunity_filter, :locals => {:f => filter_form} %>
<% end %>
#..
<% end %>
opportunities GET /questionnaires(.:format) {:action=>"index", :controller=>"opportunities"}
opportunities POST /questionnaires(.:format) {:action=>"create", :controller=>"opportunities"}
new_opportunity GET /questionnaires/new(.:format) {:action=>"new", :controller=>"opportunities"}
edit_opportunity GET /questionnaires/:id/edit(.:format) {:action=>"edit", :controller=>"opportunities"}
opportunity GET /questionnaires/:id(.:format) {:action=>"show", :controller=>"opportunities"}
opportunity PUT /questionnaires/:id(.:format) {:action=>"update", :controller=>"opportunities"}
opportunity DELETE /questionnaires/:id(.:format) {:action=>"destroy", :controller=>"opportunities"}
<%= form_for(@new_product_template,
:url => opportunity_new_product_template_path(@opportunity),
:html => {:method => :put, :multipart => true}) do |f| %>