Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8228325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:25:29+00:00 2026-06-07T16:25:29+00:00

Here is an example hash (maximum 10 per query) parsed_response = [{id=>3, pic=>/images/icons/market.png, url=>https://angel.co/mobile-4,

  • 0

Here is an example hash (maximum 10 per query)

parsed_response = [{"id"=>3, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/mobile-4", "name"=>"Mobile", "type"=>"MarketTag"}, {"id"=>12, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/enterprise-software", "name"=>"Enterprise Software", "type"=>"MarketTag"}, {"id"=>10, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/saas", "name"=>"SaaS", "type"=>"MarketTag"}, {"id"=>841, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/software", "name"=>"Software", "type"=>"MarketTag"}, {"id"=>263, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/restaurants-2", "name"=>"Restaurants", "type"=>"MarketTag"}, {"id"=>376, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/productivity-software", "name"=>"Productivity Software", "type"=>"MarketTag"}, {"id"=>942, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/embedded-hardware-and-software", "name"=>"Embedded Hardware and Software", "type"=>"MarketTag"}, {"id"=>291, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/meeting-software", "name"=>"Meeting Software", "type"=>"MarketTag"}, {"id"=>13764, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/hardware-software", "name"=>"Hardware + Software", "type"=>"MarketTag"}, {"id"=>2983, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/software-compliance", "name"=>"Software Compliance", "type"=>"MarketTag"}]

I’ve tried many methods inside of the gem I’ve been creating.

The first method was to create a special class and map each array element to that class:

class IDSearch
  attr_accessor :id, :thumbnail, :url, :name, :type
  def initialize(the_hash)
    @id   = the_hash['id']
    @url  = the_hash['url']
    @pic  = the_hash['pic']
    @name = the_hash['name']
    @type = the_hash['type']
  end
end

I’ll list them according to attempt:

Attempt 1:
IDSearch.new(parsed_response)

Attempt 2:
parsed_response.map {|t| IDSearch.new(t)}

Attempt 3:
parsed_response.each do |hsh|
SimpleAngel::IDSearch.new(hsh)
end

Attempt 4:
10.times do |i|
  instance_variable_set "@response_#{i}", parsed_response[i]        
end

Attempt 5 (getting desperate)
@response0 = parsed_response[0]
@response1 = parsed_response[1]
@response2 = parsed_response[2]
@response3 = parsed_response[3]
@response4 = parsed_response[4]
@response5 = parsed_response[5]
@response6 = parsed_response[6]
@response7 = parsed_response[7]
@response8 = parsed_response[8]
@response9 = parsed_response[9]

Attempt6: (this time inside of a rails controller)

search_object = SimpleAngel::Search.new
responses = search_object.id_search(params[:query], params[:type])
responses.each_with_index do |response, i|
  u      = Idquery.new
  u.name = response[i]['name']
  u.id   = response[i]['id']
  u.url  = response[i]['url']
  u.type = response[i]['type']
  u.pic  = response[i]['pic']
  u.save
end

None of these methods has produced a predictable, coherent, workable response.

More than an actual solution, I’m looking for a clue as to how my thinking has been flawed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:25:30+00:00Added an answer on June 7, 2026 at 4:25 pm

    In Attempt1 you are expecting a hash in the IDSearch.new and actually passing an array.
    If you instead do:

    parsed_response.each {|hash| p IDSearch.new(hash)}
    

    it works just fine.

    @id=3, @url="https://angel.co/mobile-4", @pic="/images/icons/market.png", @name="Mobile", @type="MarketTag"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's an example of two different dictionaries, yet they return the same hash code.
tell me how to get every possible combination of hash Here is an example
I found this snippet here as an example of the simplest kind of hash.
Here an example http://jsfiddle.net/EhLsT/ $(window).scroll(function () { if ($(window).scrollTop() > $(#header).offset().top) { $(#floating).show(); }
Here is example which I have try <?php include 'spider/classes/simple_html_dom.php'; $html = new simple_html_dom();
Here an example http://jsfiddle.net/7aVXc/ Let' say current image height is 400px . How do
Here an example http://jsfiddle.net/NuzDj/ If you resize windows size, sidebar overlapping the wrapper &
Example: here is the string: blablabla123:550:404:487blablabla500:488:474:401blablablabla here is what I'm using: string reg =
Example here: http://jezebel.com/5896408/racist-hunger-games-fans-dont-care-how-much-money-the-movie-made Click on the 3x3 Tweets screencap they have up. I love
The fictional example here. Suppose I designed a class named IODevice. This class already

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.