Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Adding buttons with dynamic links using Foundation framework

Hi, I'm trying to figure out how to add buttons using Foundation (which is fairly simple) and then create dynamic links using embedded ruby. I'm sure it is a super easy answer that I'm totally missing, but I keep banging my head against the wall!

The former would normally be as follows:

<a href="#" class="button radius">Radius Button</a>

The latter would be:

<%= link_to "Edit", edit_post_path(@post) %>

How do I combine the two to use a Foundation button and then use the edit_post_path link?

Thanks so much for all your help!

2 Answers

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Here's how you add your classes to your ERB link:

<%= link_to "Edit", edit_post_path(@post), class: "button radius" %>

And here's some documentation for you: http://apidock.com/rails/ActionView/Helpers/UrlHelper/link_to :)

You are awesome Maciej Czuchnowski, thank you!!!