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
# config/environments/development | |
# ActionMailer Config | |
config.action_mailer.default_url_options = { :host => 'localhost:3000' } | |
config.action_mailer.delivery_method = :smtp | |
# change to true to allow email to be sent during development | |
config.action_mailer.perform_deliveries = false | |
config.action_mailer.raise_delivery_errors = true | |
config.action_mailer.default :charset => "utf-8" | |
#config.action_mailer.default_url_options = { :host => 'your.websitedomain.com' } | |
config.action_mailer.smtp_settings = { |
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
#ERROR: Failures: | |
# 1) users/index renders a list of users | |
# Failure/Error: stub_model(User, | |
# ActiveRecord::StatementInvalid: | |
# Could not find table 'users' | |
# ./spec/views/users/index.html.erb_spec.rb:6:in `block (2 levels) in <top (required)>' | |
#app/models/user.rb | |
# == Schema Information |
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
#app/controllers/sessions.rb | |
def create | |
@login = params[:login] | |
#user = User.find__by_email_or_mobile(params[:login]) | |
if @login.include?("@") | |
user = User.find_by_email(@login.downcase) | |
else | |
user = User.find_by_mobile(@login.gsub(/\D/, '').gsub(/^(1|0)+/,'')) |
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
class Lead < ActiveRecord::Base | |
attr_accessible :email | |
has_one :referral | |
has_one :user, :through => :referrals | |
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
# == Schema Information | |
# Schema version: 20130116180743 | |
# | |
# Table name: users | |
# | |
# id :integer not null, primary key | |
# name :string(255) | |
# email :string(255) | |
# created_at :datetime not null | |
# updated_at :datetime not null |
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
# == Schema Information | |
# Schema version: 20130116180743 | |
# | |
# Table name: users | |
# | |
# id :integer not null, primary key | |
# name :string(255) | |
# email :string(255) | |
# created_at :datetime not null | |
# updated_at :datetime not null |
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
#error: | |
# irb(main):058:0> User.login_method("2223334444") | |
# NoMethodError: undefined method `gsub' for nil:NilClass | |
# from (irb):9:in `format_mobile' | |
# from /home/patrick/Rails/goldengoose/app/models/user.rb:29:in `login_method' | |
# from (irb):58 | |
# from /home/patrick/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start' | |
# from /home/patrick/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start' | |
# from /home/patrick/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>' | |
# from script/rails:6:in `require' |
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
class Lead < ActiveRecord::Base | |
attr_accessible :first_name, :last_name, :email, :phone, :address, :city, :state, :zipcode, :referral_attributes | |
has_one :referral | |
has_one :user, :through => :referral | |
delegate :name, :first_name, :last_name, :email, :phone, :address, :city, :state, :zip, :to => :user, :prefix =>true | |
# self.per_page = 5 | |
validates_presence_of :email | |
validates_uniqueness_of :email | |
accepts_nested_attributes_for :referral |
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
$response =amazonXML('1111837295'); | |
// function that creates xml object from amazon url | |
// ... $amazonXML = simplexml_load_string(file_get_contents($amazon_url)); | |
// $amazonXML->registerXpathNamespace("xmlns", "http://webservices.amazon.com/AWSECommerceService/2011-08-01"); | |
// return $amazonXML; | |
$browsenodes = $response->Items->Item->BrowseNodes->children(); | |
var_dump($browsenodes); // see bottom. | |
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
<?xml version="1.0"?> | |
<ItemLookupResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2011-08-01"> | |
<OperationRequest> | |
<RequestId>cd4fa414-b84c-445c-ba71-5c0132c3dfa3</RequestId> | |
<Arguments> | |
<Argument Name="Condition" Value="All"/> | |
<Argument Name="Operation" Value="ItemLookup"/> | |
<Argument Name="Service" Value="AWSECommerceService"/> | |
<Argument Name="ItemPage" Value="1"/> |
OlderNewer