lib/tasks/db_upsert_businesses.rake
def build_params(yelp_business)
  yelp_business.
    slice(:name, :image_url, :rating, :phone, :display_phone).
    merge(yelp_business[:location]).
    merge(yelp_business[:coordinates]).
    merge(
      yelp_uid: yelp_business[:id],
      url: yelp_business[:url].split(/\?/).first,
      price: yelp_business[:price].length,
      categories: join_categories(yelp_business[:categories]),
      display_address: yelp_business.dig(:location, :display_address)
    )
end
# Build params from yelp hash.
Build params from yelp hash.
Build params from yelp hash .
def build_params(yelp_business)
  yelp_business.
    slice(:name, :image_url, :rating, :phone, :display_phone).
    merge(yelp_business[:location]).
    merge(yelp_business[:coordinates]).
    merge(
      yelp_uid: yelp_business[:id],
      url: yelp_business[:url].split(/\?/).first,
      price: yelp_business[:price].length,
      categories: join_categories(yelp_business[:categories]),
      display_address: yelp_business.dig(:location, :display_address)
    )
end
def build_params ( yelp_business ) yelp_business . slice ( :name , :image_url , :rating , :phone , :display_phone ) . merge ( yelp_business [ :location ] ) . merge ( yelp_business [ :coordinates ] ) . merge ( yelp_uid : yelp_business [ :id ] , url : yelp_business [ :url ] . split ( / \? / ) . first , price : yelp_business [ :price ] . length , categories : join_categories ( yelp_business [ :categories ] ) , display_address : yelp_business . dig ( :location , :display_address ) ) end
Build params from yelp hash.
Build params from yelp hash .
yelp_business