public
Last active

basic ujs issue

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
new.js.erb file has the following js code
 
$('a.pinbutton').on('click', function() {
$(this).parent().append('<%= escape_javascript(render("select")) %>')
});
 
here's the player index with the new link
<%= link_to "Pin", {controller: "pinboard_players", action: "new", id: player}, remote: true, class: "pinbutton", id: "#{player.id}" %>
 
controller new action action:
def new
session[:player] = params[:id]
@pinboard_player = PinboardPlayer.new(player_id: params[:id])
@current_user_pinboards = get_user_pinboards
respond_to do |format|
format.html
format.js
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.