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
Testing |
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 create | |
logout_keeping_session! | |
if using_open_id? | |
authenticate_with_open_id(params[:openid_url], :return_to => open_id_create_url, | |
:required => [:nickname, :email]) do |result, identity_url, registration| | |
if result.successful? | |
create_new_user(:identity_url => identity_url, :login => registration['nickname'], :email => registration['email']) | |
else | |
failed_creation(result.message || "Sorry, something went wrong") | |
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
def owns?(user) | |
# Am I duplicating this? Does this exist somewhere? (paco) | |
# Where do you use it? (chubas) | |
# Are you free this weekend? (paco) | |
logged_in? && user == current_user | |
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
<% form_for @offer do |f| %> | |
<%= f.label :version, 'Version' %>: | |
<%= f.text_field :version %><br /> | |
<%= f.label :author, 'Author' %>: | |
<%= f.text_field :author %><br /> | |
<% 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
// Es de Yahoo, pero puedes cambiarlo a cualquier pagina que publique el tipo de cambio | |
mx_rate = YahooCurrency.get_rate!("USD", "MXN") | |
sub_number_to_currency(@product.price * mx_rate.rate) |
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
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails) |
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
[404, {"Content-Type" => "text/html"}, ["Not Found"]] |
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
gateway.transfer 1000, '[email protected]', | |
:subject => "The money I owe you", :note => "Sorry it's so late" | |
gateway.transfer [1000, '[email protected]'], | |
[2450, '[email protected]', :note => 'You will receive another payment on 3/24'], | |
[2000, '[email protected]'], | |
:subject => "Your Earnings", :note => "Thanks for your business." |
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
require 'open-uri' | |
def roulette(bet) | |
open('http://roulette.engineyard.com/').read.match("13") ? 35 * bet : 0 | |
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
# For finding images as in Article.attachments.images | |
scope :images, where("file_content_type LIKE ?", "image%") | |
# For finding other files Article.attachments.docs | |
scope :docs, where("file_content_type NOT LIKE ?", "image%") |
OlderNewer