There's a problem with the escaping in firefox 10. Apparently it will escape the escaped_country variable again:
escaped_country === "United\\ States"
true
escaped_country === "United\ States"
false
And it will break the filter...
Any idea what browser we actually need to escape first? I've tested with IE8 and chrome and they also both work with \' in the country name without escaping.
it 'takes time'doBenchmark.realtime{
get :index
}.should < 1.5end
It would be awesome to see some native support for RSpec, if it is appropriate, but the real question is why there is no API yet in RSpec, being such a popular project.
Thanks Ryan - awesome as usual and well worth the wait!
It's probably worth mentioning that the reason number_to_currency is popping up is because the example page isn't doing much, so the time spent in the call becomes significant.
I have category and subcategory table and another table shop.
Each shop have many categories and categories have many subcategories.
The user belongs to one shop and how can i say in ability the user of this shop can edit the subcategories that belongs to the category of that shop.
Can you post your code? Are you using HABTM or HMT? Have you created a join table? You will definitely need attr_accessible :skill_ids for Rails 2/3, or params.require(:model).permit(:skill_ids) in the controller if you're using Rails 4. I'm happy to help if you can share your code. Maybe add it to a gist and then reference it in a reply.
The datepicker works perfectly for anything being edited that isn't within properties. Troubleshooting it seems that the issue is jQuery being called/attached/whatever-term-you-want before the builder finishes. If I add the following lines, the name will trigger its changes, but the date will not.
products.js.coffee
# For the sake of testing, I've hard-wired the id names in to eliminate passing the id names as being the problem.
jQuery ->
$("#hardware_model_name").change ->
alert "name has been changed"
jQuery ->
$("#hardware_model_properties_test_date").change ->
alert "date has been changed"
How does one properly include the jQuery for render calls?
The table builder date selection is not recognized by Rails (3.2.11). After selecting the date and creating the new object, the date fails my 'presence: true' validation. I get an error message "Date can't be blank'.
One more quick discovery/question. With the second method, I was getting spurious locking errors added to base on creation. It turned out acts_as_list and other such plugins intercept the create process and perform some quick saves to get things in the right place. Not sure I completely understand, but I needed to pass the validation if nothing was in the changes array:
ruby
# app/models/item.rbdefhandle_conflictif@conflict || updated_at.to_f > original_updated_at.to_f
# Commented out because of ability to submit again and overwrite previous value# @original_updated_at = nil # acts_as_list and other items update the position and cause spurious conflicts during creationif changes.empty?
@conflict = falseelse@conflict = true
errors.add :base, "Snap! Someone signed up for this just a moment ago. Pick something else?"
changes.each do |attribute, values|
errors.add attribute, "has just been reserved. Cancel to reload sheet."endendendend
This got my simple creation action up and running again. Thanks for this great episode and any insights on whether this is a short sighted fix. Charles
From my point of view the EmberJs is really powerfully, but apply the EmberJs inside partially client side site is super hard (for me)!
I found really nice alternative the Serenade.js. On home page examples of code with is really easy to understand. I feel that I have control over code, I can understand how it work.
Thanks so much as always! There is an episode for nearly every thing I want to do! Amazing!
Using the second method, I had a behavior with a remote form that I wanted to pass by the group. I got the first validation error just fine. If I hit submit again, however, the old value would pass the validation the second time and overwrite the value that was protected the first time around.
In other words, the conflict was not detected because @original_updated_at was set to nil and the object reloaded the new timestamp and passed the update right through. If I comment out the @original_updated_at = nil line, I get the behavior I want -- a durable block on any updates to that record.
Does this make sense? What was the value of setting @original_updated_at to nil in the code? Thanks for any advice you might have! Charles
You are totally correct, it really does what you said, which is the best solution. But I too share your problem: TextPost and Picture have comments (which I'd like to eagerly load), and SpreadSheet has collaborators, which I'd also like to eagerly load.
I get the following error after running "cap rubber:create_staging
/Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/middlewares/expects.rb:10:in response_call': Unable to find group 'blog_production_default' (Fog::Compute::AWS::NotFound)
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/connection.rb:332:inresponse'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/connection.rb:226:in request'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/middlewares/idempotent.rb:12:inerror_call'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/middlewares/base.rb:10:in error_call'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/connection.rb:239:inrescue in request'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/connection.rb:200:in request'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/middlewares/idempotent.rb:12:inerror_call'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/middlewares/base.rb:10:in error_call'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/connection.rb:239:inrescue in request'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/connection.rb:200:in request'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/middlewares/idempotent.rb:12:inerror_call'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/middlewares/base.rb:10:in error_call'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/connection.rb:239:inrescue in request'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/connection.rb:200:in request'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/fog-1.10.0/lib/fog/core/connection.rb:21:inrequest'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/fog-1.10.0/lib/fog/aws/compute.rb:384:in _request'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/fog-1.10.0/lib/fog/aws/compute.rb:379:inrequest'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/fog-1.10.0/lib/fog/aws/requests/compute/authorize_security_group_ingress.rb:54:in authorize_security_group_ingress'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/fog-1.10.0/lib/fog/aws/models/compute/security_group.rb:104:inauthorize_port_range'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/cloud/fog.rb:182:in add_security_group_rule'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/thread_safe_proxy.rb:13:inmethod_missing'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/recipes/rubber/security_groups.rb:218:in block (2 levels) in sync_security_groups'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/recipes/rubber/security_groups.rb:214:ineach'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/recipes/rubber/security_groups.rb:214:in block in sync_security_groups'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/recipes/rubber/security_groups.rb:208:ineach'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/recipes/rubber/security_groups.rb:208:in sync_security_groups'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/recipes/rubber/security_groups.rb:51:insetup_security_groups'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/recipes/rubber/instances.rb:268:in block in create_instance'
from <internal:prelude>:10:insynchronize'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/recipes/rubber/instances.rb:267:in create_instance'
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/recipes/rubber/instances.rb:230:inblock (2 levels) in create_instances'
For whatever reason it doesn't understand the _ids (with the extra 's'). I tried to add :skill_ids in the attr_accessible area but it just gives me another issues:
Thank you very much for covering some Ember.js casts, it was enough for me to get me to start using it. Like giving me the right keys to open the doors I need.
I didn't miss tests like others suggested, my opinion is that it keeps you up in speed with covering several subjects in a short time.
To all the guys with suggestions to make the casts more sophisticated, packed with tests or other app types, don't need another peepcode.com site. I like the weekly and relatively short casts.
By using includes there, the polymorphic association is loaded in the best possible way (meaning that first it runs a query to load the feed items, and then, judging by the id/types it does a query for each type, and not for each instance, which from my point of view it's the best possible way to do it)
I had a more difficult problem posted here where I wanted to do an includes on the polymorphic model to eager-load other associated models, but ended up doing a manual sweep
Can partials be cached with this approach?
Wow .. Better Errors is excellent ... Love it
I also had to use Unicorn to get the pdf to load.
However, PDFKit leaves me with this dilema:
Option 1:
Enable CSS to show up on page. Unfortunately, no text / content will show up!
Option 2:
Do not have any CSS on the page. Now the text / content shows up!
Oh joy. Hoping Prawn will leave me with more desirable options...
Is there any way to only call activities which have an owner in the controller as opposed to the view?
I've followed this tutorial just like it is but it gave me this:
SMTP error: 530 5.5.1 Authentication Required.
i've google it everywhere and finally i could! using the SMTP configuration like this:
I hope it helps,
Best Regards!
Same problem here. Submitted it as an issue on the gem - https://github.com/rubber/rubber/issues/319.
@carlosmendes @skwasha @Heber Massami Nunomura @rich833 @kmamit Did you get it to work and how?
Edit
If I do cap deploy afterwards, then it deploys and works fine, but this issue should probably be fixed
I have used https://github.com/dbrady/tourbus for simulating multiple concurrent users. you will need to use jruby to run the test client.
Good episode - thanks.
juts wondering if anyone knows of a way to load / stress test a rails app simulating multiple users logging in at the same time
Cheers Ryan, much appreciated.
One thing tho (that doesn't really matter!)...
entires_controller.js.coffee should be entries_controller.js.coffee surely?
+1 on Rachid comments - one of the things I love about railscasts is how succinct they are.
There's a problem with the escaping in firefox 10. Apparently it will escape the escaped_country variable again:
And it will break the filter...
Any idea what browser we actually need to escape first? I've tested with IE8 and chrome and they also both work with \' in the country name without escaping.
There is this Gist I have found: https://gist.github.com/galaxylord/1451289
It basically boils down to this:
It would be awesome to see some native support for RSpec, if it is appropriate, but the real question is why there is no API yet in RSpec, being such a popular project.
All my request seem to get canceled after 650 ms.
the console starts and then the status is cancelled? seems the timeout isn't working, as I read the default timeout is 650ms. any ideas?
Thanks Ryan - awesome as usual and well worth the wait!
It's probably worth mentioning that the reason number_to_currency is popping up is because the example page isn't doing much, so the time spent in the call becomes significant.
FYI, I think rake test:benchmark is currently broken with rails 4 beta.
I am using cancan for assigning roles to user.
I have category and subcategory table and another table shop.
Each shop have many categories and categories have many subcategories.
The user belongs to one shop and how can i say in ability the user of this shop can edit the subcategories that belongs to the category of that shop.
Is there a way to use this with RSpec?
I'm curious: How can the tasks be configured to be more lightweight? (i.e. not loading the entire rails environment)
Can you post your code? Are you using HABTM or HMT? Have you created a join table? You will definitely need
attr_accessible :skill_ids
for Rails 2/3, orparams.require(:model).permit(:skill_ids)
in the controller if you're using Rails 4. I'm happy to help if you can share your code. Maybe add it to a gist and then reference it in a reply.Thank you very much. This saved me a lot of time.
+1
Does anyone know if there is a way to get multiple file uploads and the progress bars to work in IE?
+1
In the end I dropped the jQuery file upload gem soloution all together & followed Episode #196 for uploading multiple images.
+1
I'm combining this with dynamic forms from episode #403. The jQuery doesn't fire for the properties when looping through the following lines...
The datepicker works perfectly for anything being edited that isn't within properties. Troubleshooting it seems that the issue is jQuery being called/attached/whatever-term-you-want before the builder finishes. If I add the following lines, the name will trigger its changes, but the date will not.
How does one properly include the jQuery for render calls?
The table builder date selection is not recognized by Rails (3.2.11). After selecting the date and creating the new object, the date fails my 'presence: true' validation. I get an error message "Date can't be blank'.
Has anyone seem this type of error?
(Note: I am using watu table builder)
Have you restarted your server? that was my problem
One more quick discovery/question. With the second method, I was getting spurious locking errors added to base on creation. It turned out acts_as_list and other such plugins intercept the create process and perform some quick saves to get things in the right place. Not sure I completely understand, but I needed to pass the validation if nothing was in the changes array:
This got my simple creation action up and running again. Thanks for this great episode and any insights on whether this is a short sighted fix. Charles
From my point of view the EmberJs is really powerfully, but apply the EmberJs inside partially client side site is super hard (for me)!
I found really nice alternative the Serenade.js. On home page examples of code with is really easy to understand. I feel that I have control over code, I can understand how it work.
Hope it will help :-)
Thanks so much as always! There is an episode for nearly every thing I want to do! Amazing!
Using the second method, I had a behavior with a remote form that I wanted to pass by the group. I got the first validation error just fine. If I hit submit again, however, the old value would pass the validation the second time and overwrite the value that was protected the first time around.
In other words, the conflict was not detected because @original_updated_at was set to nil and the object reloaded the new timestamp and passed the update right through. If I comment out the @original_updated_at = nil line, I get the behavior I want -- a durable block on any updates to that record.
Does this make sense? What was the value of setting @original_updated_at to nil in the code? Thanks for any advice you might have! Charles
Why not use Postgres' full-text search @@ operator rather than LIKE?
help,i have a trouble with the pjax ..
btw,my english is pool,maybe there's some mistakes ~
ok,i download the lastest pjax at https://github.com/defunkt/jquery-pjax
then code as the demo,but it doesn't work,also there's no errors.
when i click on the link,it refresh whole page.
could any one help me ?thanks a lot!
email:miles.luffy@gmail.com
Years later, this is still very helpful, Thanks!
You are totally correct, it really does what you said, which is the best solution. But I too share your problem:
TextPost
andPicture
have comments (which I'd like to eagerly load), andSpreadSheet
has collaborators, which I'd also like to eagerly load.I am also getting the "An unexpected error has occurred. We have been notified of the problem.". Has anyone found a solution???
Thank you willkoehler.
Did anyone track down this problem? I'm still trying to find a solution.
I had the same problem, then I installed the following gems and it worked fine! (Rails 3.2.8)
gem "therubyracer"
gem "less-rails"
I get the following error after running "cap rubber:create_staging
/Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/middlewares/expects.rb:10:in
response_call': Unable to find group 'blog_production_default' (Fog::Compute::AWS::NotFound)
response'from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/connection.rb:332:in
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/connection.rb:226:in
request'
error_call'from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/middlewares/idempotent.rb:12:in
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/middlewares/base.rb:10:in
error_call'
rescue in request'from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/connection.rb:239:in
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/connection.rb:200:in
request'
error_call'from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/middlewares/idempotent.rb:12:in
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/middlewares/base.rb:10:in
error_call'
rescue in request'from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/connection.rb:239:in
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/connection.rb:200:in
request'
error_call'from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/middlewares/idempotent.rb:12:in
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/middlewares/base.rb:10:in
error_call'
rescue in request'from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/connection.rb:239:in
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/connection.rb:200:in
request'
request'from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/fog-1.10.0/lib/fog/core/connection.rb:21:in
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/fog-1.10.0/lib/fog/aws/compute.rb:384:in
_request'
request'from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/fog-1.10.0/lib/fog/aws/compute.rb:379:in
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/fog-1.10.0/lib/fog/aws/requests/compute/authorize_security_group_ingress.rb:54:in
authorize_security_group_ingress'
authorize_port_range'from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/fog-1.10.0/lib/fog/aws/models/compute/security_group.rb:104:in
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/cloud/fog.rb:182:in
add_security_group_rule'
method_missing'from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/thread_safe_proxy.rb:13:in
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/recipes/rubber/security_groups.rb:218:in
block (2 levels) in sync_security_groups'
each'from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/recipes/rubber/security_groups.rb:214:in
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/recipes/rubber/security_groups.rb:214:in
block in sync_security_groups'
each'from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/recipes/rubber/security_groups.rb:208:in
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/recipes/rubber/security_groups.rb:208:in
sync_security_groups'
setup_security_groups'from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/recipes/rubber/security_groups.rb:51:in
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/recipes/rubber/instances.rb:268:in
block in create_instance'
synchronize'from <internal:prelude>:10:in
from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/recipes/rubber/instances.rb:267:in
create_instance'
block (2 levels) in create_instances'from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/recipes/rubber/instances.rb:230:in
+1
I followed along but am getting this error
Can't mass-assign protected attributes: skill_ids
For whatever reason it doesn't understand the _ids (with the extra 's'). I tried to add :skill_ids in the attr_accessible area but it just gives me another issues:
unknown attribute: skill_ids
HELP!
+1
Hi Ryan,
Thank you very much for covering some Ember.js casts, it was enough for me to get me to start using it. Like giving me the right keys to open the doors I need.
I didn't miss tests like others suggested, my opinion is that it keeps you up in speed with covering several subjects in a short time.
To all the guys with suggestions to make the casts more sophisticated, packed with tests or other app types, don't need another peepcode.com site. I like the weekly and relatively short casts.
Keep up the good work Ryan, keep it simple!
+1
I was confused by the following error:
Since Capybara 2.0 one has to use folder
spec/features
Capybara commands don't work in folderspec/requests
anymore.Which I learned by your link. - Thanks!
+1 thanks for this. :)
+1
As someone named Jake, you sure caught my attention at 1:27.
By using includes there, the polymorphic association is loaded in the best possible way (meaning that first it runs a query to load the feed items, and then, judging by the id/types it does a query for each type, and not for each instance, which from my point of view it's the best possible way to do it)
I had a more difficult problem posted here where I wanted to do an includes on the polymorphic model to eager-load other associated models, but ended up doing a manual sweep
I agree. They are they a good reminder for optimization techniques and what has been deprecated as we move move into new Rails versions.
You need to substitute this line
with this other line in the initialize method of the paintings.js.cofee file