Question

I'm very new to both rails and mailchip. I'm able to retrieve all my lists inside my controller with the below code

class EmailsController < ApplicationController

  def new
    @email = Email.new
    @gbList = Gibbon::API.lists.list
    puts "@gbList", @gbList
  end

end

I can see all my lists in my console. What I'm trying to do is retrieve one of those lists via the name attribute. For example my list is called "My eList" I tried doing:

@eList = Gibbon::API.lists.list(:list_name => "My eList");

But this still returns an array of all my lists.

Was it helpful?

Solution

Pass the list_name key-value pair as a member of the filters hash. See the Gibbon documentation on Fetching Lists for more info:

@eList = Gibbon::API.lists.list({:filters => {:list_name => 'My eList'}})
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top