Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ApplicationController < ActionController::Base
- def favorite_text
- return @favorite_exists ? "UnFavorite" : "Favorite"
- end
- helper_method :favorite_text
- end
- <%= link_to favorite_text, favorites_update_path(post: @post), id: 'favorite_link', remote: true %>
- #função que faz o texto trocar
- $('#favorite_link').text("<%= favorite_text %>");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement