So i have ruby code that simply writes all of my objects down in some view
%ul
- @user.posts.each do |post|
%li {data: {role: "choosable-post"}}
= post.title
Now the trick is those are not posts itself, just the titles. how can i get the id of a specific post with jQuery? Of course User has_many :posts so every post has an id of its own.
i figured it could start like this...
$("li[data-role=choosable-post]").onclick ->
my_object = @(this)
but i dont really know if its a good direction or how to continue if it is...
posthave an id attribute in ruby? If so then do what they say below.