Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

ahnbizcad's Profile

GitHub User: ahnbizcad

Comments by

Avatar

So all that "complex" logic goes in the js files, and routing is done through angular. Does all of this make the rails functionality for these tasks redundant? How do you resolve or use both simultaneously?

Avatar

so years later in rails 4, is Kaminari still better, cleaner, and frequently updated as will_paginate?

Avatar

What is wrong with my coffeescript?

The JSON.parse line is causing the site to fail.
I cannot use var either.

jQuery ->
$percentage_neti = JSON.parse($('#vote-data'))
$('.bar-neti').css("width", $percentage_neti + '%')

(the last two lines are indented)

Avatar

Thank you so much. Simple, elegant, better.

How could you use the retrieved data as CSS attributes or element names?

1)
Once I have the rails data in js, how would I use that value to set the width of a vote bar div to that calculated percentage value?

Something like

$('.vote-bar').css("width", "#{percentage}%");
But I know the syntax is not right.

2)
How could I also use the rails text data as the name of a class? If my rails data returns 52 via json, I want to select an element named $('#item-52') in js...

Avatar

such impress. very thanks.

I think this is one of the very few resources out there that explains how rails is constructed. And it does so in the Ryan Bates's concise-yet-thorough style.

Having this primer will save so much time reading through the rails source code.

Avatar

How would you implement chosen or select2 if your has_many through join table is not using the default id as a primary key? Is the syntax author_ids something rails handles automagically in the standard join table?

Avatar

Thank you so much! The issue was pg using different query syntax. good to know!

I'm still having an issue where the existing tags don't show up when I go to the edit page.

Avatar

Would you also need a comma after 'facebook'? If not, why?

Avatar

Thank you so much, I've been looking for doing this with has_many :through for so long. I'm trying to work this with autocomplete as well. It's surprising how so few results there are for "has many through autocomplete" in a search.