Code:
class Client::CouponDunia end class CouponDuniaData::Client c = Client::CouponDunia.new #Define The Empty Array To get the record from Coupon Dunia category_arr = [] category_arr = c.all_categories.last @transaction_category = TransactionCategory.new #Loop For Categories that Will Come Across From Coupon Dunia category_arr.each do |i| cat_name = nil cat_name = i.to_hash @transaction_category = TransactionCategory.new(user_id: 1, active:1, private_category_flag:1, category_name:cat_name["Name"]) if @transaction_category.save puts "Transaction Category Details are successfully Saved" puts cat_name #redirect_to @transaction_category else p @transaction_category.errors.full_messages.to_sentence #render 'new' end end end
Comment