Forum: Typo Amazon Sidebar Component Broken?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A73f446eaaf56db0aeaa578aa373989b?d=identicon&s=25 Terry Donaghe (Guest)
on 2006-04-15 18:18
(Received via mailing list)
Hi,

I'm trying to figure out how to use the Amazon Sidebar component.  Is it
currently broken?  I've tried every sort of Amazon link I can think of
and I
never get anything on my sidebar dealing with Amazon.  Is there a proper
way
to set up my URLs so that they'll work?  Here's what I've been using:

http://www.amazon.com/exec/obidos/ASIN/097669400X/...
and just
http://www.amazon.com/exec/obidos/ASIN/097669400X/

Neither of these cause anything to show up on the sidebar.

Thanks for any clues here!

Terry
A73f446eaaf56db0aeaa578aa373989b?d=identicon&s=25 Terry Donaghe (Guest)
on 2006-04-15 18:48
(Received via mailing list)
This is the line of code that's confusing me:

asin_list = params[:contents].to_a.inject([]) { |acc, item| acc |
item.whiteboard[:asins].to_a }

When I set a breakpoint after this line, asin_list always contains
nothing.

params[:contents] contains a ton of stuff including the html contents of
my
blog.

asin_list = params[:contents].to_a.inject([]) { |acc, item| acc}
returns nothing

asin_list = params[:contents].to_a.inject([]) { |acc, item| item }
returns pretty much the same thing as params[:contents]

Toward the end of the string returned by the last asin_list above,
there's
this: "whiteboard" =>{}
So, it looks to me that something should be setting something into this
whiteboard, maybe.

If I look at:
asin_list = params[:contents].to_a.inject([]) { |acc, item|
item.whiteboard}
I get {}

Similarly
asin_list = params[:contents].to_a.inject([]) { |acc, item|
item.whiteboard.to_a }
returns []

So, what's the whiteboard, and how does stuff get into it?

Terry


asin_list = params[:contents].to_a.inject([]) { |acc, item|
item.whiteboard[:asins].to_a
}
A73f446eaaf56db0aeaa578aa373989b?d=identicon&s=25 Terry Donaghe (Guest)
on 2006-04-15 19:10
(Received via mailing list)
Ok - I figured out how to make it work.  The only way I could get it to
work
was to choose a blog text filter which included the Amazon post
processing
filter.  The Amazon Controller for the text filter plugin adds the asin
to
the whiteboard.  So, after setting that up, to include an Amazon URL,
you
put in your anchor tag like this:

<a href="amazon:097669400X">

and it turns into:
<a
href="http://www.amazon.com/exec/obidos/ASIN/097669400X/...

With your own associate ID at the end.

This was extremely not straightfoward.  D'oh!
This topic is locked and can not be replied to.