This file contains hidden or 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 unsubscribe | |
# using base64 encoding in the url to prevent unsubscribe abuse | |
@user = User.find_by_access_token(Base64.decode64(params[:token])) # find the user from the ID in url | |
if @user.opt_out! | |
redirect_to root_url, :notice => "We won't bug you with emails!" # give them a little notice that it worked | |
else | |
render :text => "Could not find your access token, did you copy-paste the correct email from the unsubscribe? Just email us at blah2blah.com" | |
end | |
end |
This file contains hidden or 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 FalseClass | |
def affirmative? | |
false | |
end | |
end | |
class NilClass | |
def affirmative? | |
false | |
end |
This file contains hidden or 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
Swarm3::Application.routes.draw do | |
devise_for :users | |
resources :swarm_requests do | |
put 'accept_requester_price_now', :on => :member | |
resources :bids do | |
put 'accept', :on => :member | |
end |
This file contains hidden or 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
<% @body_onload = "initialize();" %> | |
<script type="text/javascript"> | |
function initialize() { | |
// default to Atlanta | |
//custom styling variables | |
var stylez = [ | |
{ |
This file contains hidden or 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 Widget < ActiveRecord::Base | |
AMERICAN_COLORS = %w(red white blue) | |
# /(red|white|blue)/i | |
validate :must_be_american | |
def must_be_american | |
unless AMERICAN_COLORS.include?(self.color.downcase) | |
errors.add(:color, " has to be american (#{AMERICAN_COLORS.to_sentence}, buddy....") |
This file contains hidden or 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 User < ActiveRecord::Base | |
# Paperclip | |
has_attached_file :photo, | |
:styles => { | |
:thumb=> "100x100#", | |
:small => "150x150>", | |
:medium => "300x300>", | |
:large => "400x400>" } | |