addis_a
1
Hi,
I am getting the error:
undefined method `symbolize_keys’ for “/contents/index_books/13”:String
for the following:
<%= link_to(image_tag src= asset_path("#{subject.icon}" + ‘.png’),
index_books_path(:subject_id => subject.id)) %>
I understand that a hash is expected and a string is being found, but
not sure why. Is my syntax incorrect?
Thanks,
Dave C.
pezdude
2
Dave A. wrote in post #1162130:
Try fixing the “src=” bit. That’s HTML, not Ruby.
<%= link_to(image_tag asset_path("#{subject.icon}" + ‘.png’),
index_books_path(:subject_id => subject.id)) %> still throws same error.
<%= image_tag asset_path("#{subject.icon}" + ‘.png’) %> works fine so I
am assuming its the link_to and not the image_tag.
Dave
pezdude
3
On Monday, November 10, 2014, Dave C. [email protected]
wrote:
I am getting the error:
undefined method `symbolize_keys’ for “/contents/index_books/13”:String
for the following:
<%= link_to(image_tag src= asset_path(“#{subject.icon}” + ‘.png’),
index_books_path(:subject_id => subject.id)) %>
Try fixing the “src=” bit. That’s HTML, not Ruby.
–
Sent from Gmail Mobile; please excuse top posting, typos, etc.
pezdude
4
On 10 November 2014 21:17, Dave C. [email protected] wrote:
Dave A. wrote in post #1162130:
Try fixing the “src=” bit. That’s HTML, not Ruby.
<%= link_to(image_tag asset_path(“#{subject.icon}” + ‘.png’),
index_books_path(:subject_id => subject.id)) %> still throws same error.
I suspect you are passing index_books_path() as a second parameter to
image_tag.
<%= image_tag asset_path(“#{subject.icon}” + ‘.png’) %> works fine so I
am assuming its the link_to and not the image_tag.
A wrong assumption I think
Colin
pezdude
5
On 2014-Nov-10, at 16:17 , Dave C. [email protected] wrote:
Dave A. wrote in post #1162130:
Try fixing the “src=” bit. That’s HTML, not Ruby.
<%= link_to(image_tag asset_path(“#{subject.icon}” + ‘.png’),
index_books_path(:subject_id => subject.id)) %> still throws same error.
Try it without attempting to elide the parentheses around the single
argument of image_tag:
<%= link_to(image_tag(
asset_path(“#{subject.icon}” + ‘.png’)
),
index_books_path(:subject_id => subject.id)
) %>
Your version is almost certainly being interpreted as if you had put:
<%= link_to(image_tag(asset_path(“#{subject.icon}” + ‘.png’),
index_books_path(:subject_id => subject.id)
)
) %>
pezdude
6
OK, Got it!! Thanks for the help!
Dave C.