Get all comments for a Item using Ruby Podio Gem

Answered

Comments

3 comments

  • Andreas Haugstrup Pedersen

    Hi Uploader,

    When you get a list of items Podio doesn't return all individual comments for each item. That's too much data to return in most cases. So if you need the comments you'll need to get each item individually e.g. Podio::Item.find_basic(item.id)

    /Andreas

    0
    Comment actions Permalink
  • Uploader

    Hi,

    Thanks for the answer and I understand that.

    Currently I am using Ruby on Rails for a project and would like to get the association working. So that I could get a list of all items comments using the  items has_many comments association.

    i.e. I would like to be able to do something like

    item.comments.each do |c|

      puts c.value

    end

    Currently, calling the comments method on an item object always returns and empty array, and calling the comments? method for the object always returns false, even if the item does have comments.

    Is it possible to get the association working as described above?

     

    Thanks

    0
    Comment actions Permalink
  • Andreas Haugstrup Pedersen

    Hi Uploader,

    While podio-rb looks a lot like active record it doesn't work quite in the same way (mainly because it's a much more expensive operation to fetch data from the Podio API than from a local database). So you won't find all properties populated all the time. As I mentioned you'll have to fetch each item individually if you want to see the comments. I.e. you'll have to do Podio::Item.find(your_item_id) to get the item and then the comments will be populated.

    Makes sense?

    /Andreas

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk