I switched over to strong_parameters and this has broken the basic CSV import method outlined in this screencast I am using on a Documents model. Wondering what syntax I would need to use to fix this line to work with strong_parameters.
Im having problems getting it to import without adding in new records rather than updating existing. Sometimes it doesn't appear to be doing anything. I cant figure why though!
Somehow I get nil values for crop_x, crop_y, crop_w, and crop_h,
I've put
"
attr_accessible :name, :email, :password, :password_confirmation, :avatar,
:crop_x, :crop_y, :crop_w, :crop_h
attr_accessor :crop_x, :crop_y, :crop_w, :crop_h
"
already.. it shows correct values in the hidden text field and the after-save debug dump on browser, but cropping? ALWAYS evaluate to false!..
Hi Amunda, if I understand your question correctly, it's not a problem. That if statement is only checking whether the comments container element is on the page. If it is, then we know we're on the right page, and it would call CommentPoller.poll(). if its not, then we dont need to use the JS
I am trying to install fnordmetric gem in my rails application. I installed the gem with this command sudo gem install fnordmetric. Gem is installed but i am getting this error when i run the server through script/server
invalid gemspec in illformed requirement in /usr/local/lib/ruby/gems/1.8/specifications/fnordmetric-1.0 gemspec
and in /code/ts-delayed-delta/ruby/gems/1.8/specifications/fnordmetric-1.0 gemspec
I updated the gems using sudo gem update --system. Still i am getting the same error.
Can anyone suggest me how to overcome this problem..?
Thank you in advance
Yup. same problem for me regardless of how remember_me checkbox is checked. Permanently logged in even between browser launches unless explicitly signing out…
Love the example! I also think polling is a viable solution for many applications. Unfortunately, I'm not a big fan of coffee script so JS based episodes like these require a bit more focus on my part...but maybe that means I should start using coffee script?
What would you recommend when it comes to the /spec/vcr directory and version control?
I imagine it would be pretty safe to ignore the directory, because the cassette files would be generated on the first test run for each checkout of the repository (assuming you use record: :new_episodes)
On the other hand, if you're communicating with an unreliable server, it could be a pain to re-record the interactions correctly.
Awesome as usual. By the way i was wondering shouldn't this method CommentPoller.poll() be outside the 'if' clause because if the comments is < 0 then it will never poll again
I'm new to Rails, and I'm having trouble figuring out how the logout link, session_path("current"), is routing to the destroy method in the controller?
I use the gem s3_direct_upload inspirated by the code, but I have a problem.
Upload and progress bar works perfectly, my problem is :
The url of the uploaded file is a part a a Medium I create. The Medium contain "name", "description", "file_url" etc.
I don't display the S3 form at the creation of my medium, after saving, I redirect_to the Edit action and then display the S3 form to add a file. I tried to set post:media_url(@medium) or post:medium_edit_path(@medium) but it doesn't work cos I guess update require PUT and not POST.
So, is it possible to implement PUT with the gem or may I do something different ?
Great explanation of polling, thanks very much. I love how you build on extra functionality in your videos and go basic > intermediate > advanced with the extra features you keep adding on.
I concur with Kevin. I've come to Ruby & Rails with a background in other programming languages and frameworks (C, Perl, Scheme and Java). The rails API doco is somewhat half-baked, so I am very interested in deep-dive walkthroughs and I have no problem keeping up. And the pause button is there if one needs to chew on the substance a little more.
Great tutorial! You can even take it a step further and only pull when the user gets down to the comments area. It's relatively easy to get info about where the browser viewport is in proportion to other elements.
It seems that indexing columns doesn´t have any effect when you are ALSO searching against associated tables
From PGSearch :
It is possible to search columns on associated models. Note that if you do this, it will be impossible to speed up searches with database indexes. However, it is supported as a quick way to try out cross-model searching.
Thank you Graeme, it was very helpful
I, too, would enjoy something on sockets other than the Faye episode.
I switched over to strong_parameters and this has broken the basic CSV import method outlined in this screencast I am using on a Documents model. Wondering what syntax I would need to use to fix this line to work with strong_parameters.
document.attributes = row.to_hash.slice(*accessible_attributes)
how did you solve your problem mahmoud?
Not working with Office in Windows and Google Docs.
Office in Windows and Google Docs don't show de spreadsheet (corrupted file) :(
Hi Ryan, this tutorial is great. Do you think is possible to have a similar tutorial for socket/comet/push interupt service?
awesomeness on every railscast!
Please expand on not using Delayed_job with rails directly
Thanks. The
module
insideclass
was suggested by @rbates himself.I'm trying to import an excel xml that was created like 362-exporting-csv-and-excel http://railscasts.com/episodes/362-exporting-csv-and-excel?view=asciicast
I get the following error
c:/ruby/lib/ruby/gems/1.8/gems/parseexcel-0.5.2/lib/parseexcel/
olestorage.rb:354:in `get_header': OLE::UnknownFormatError
(OLE::UnknownFormatError)
ruby-roo/ parseexcel cannot read the excel xml file type?
Im having problems getting it to import without adding in new records rather than updating existing. Sometimes it doesn't appear to be doing anything. I cant figure why though!
I believe jQuery is clever enough to work out that it's JSON anyway.
You're defining a class name Portrait as descending from ActiveRecord::Base.
Then you redefining it without ActiveRecord. You can't do that.
Suggestion: wrap your Portrait class (non ActiveRecord) in a module with the name of you app. If you app is called Store, so
Also, don't put a module inside the class like this. Module are not meant to be used as classes.
Thanks! I have been looking for something like this.
Wow! Great resource! Thanks!
For security concerns, is there any possible way to disable the route-showing feature and /rails/info feature?
Somehow I get nil values for crop_x, crop_y, crop_w, and crop_h,
I've put
"
attr_accessible :name, :email, :password, :password_confirmation, :avatar,
:crop_x, :crop_y, :crop_w, :crop_h
attr_accessor :crop_x, :crop_y, :crop_w, :crop_h
"
already.. it shows correct values in the hidden text field and the after-save debug dump on browser, but cropping? ALWAYS evaluate to false!..
Anyone know why this is?
Same here.
http://js2coffee.org/
Converter JS -> Coffee and Coffee -> JS maybe that helps
I'm trying to use the newer Mercury editor and it is not saving. If anyone can help I would appreciate it:
http://stackoverflow.com/questions/14366307/mercury-editor-0-9-0-cannot-save-changes-in-rails-3-2-11
Has anyone used this with bootstrap modal ?, when I add a modal with fileupload not found.
Hi Amunda, if I understand your question correctly, it's not a problem. That if statement is only checking whether the comments container element is on the page. If it is, then we know we're on the right page, and it would call CommentPoller.poll(). if its not, then we dont need to use the JS
Hey Ryan,
thank you for the great screencast.
It would be nice if you make another screencast on active_admin on some advanced topics like file uploads and integration with globalize3.
Cheers
I am trying to install fnordmetric gem in my rails application. I installed the gem with this command sudo gem install fnordmetric. Gem is installed but i am getting this error when i run the server through script/server
invalid gemspec in illformed requirement in /usr/local/lib/ruby/gems/1.8/specifications/fnordmetric-1.0 gemspec
and in /code/ts-delayed-delta/ruby/gems/1.8/specifications/fnordmetric-1.0 gemspec
I updated the gems using sudo gem update --system. Still i am getting the same error.
Can anyone suggest me how to overcome this problem..?
Thank you in advance
If you're using this now, note that the example in the github repo is incorrect
https://github.com/rails/pjax_rails
should be:
not:
see issue:
https://github.com/rails/pjax_rails/issues/51
Is there a way to use this for pages that contain mostly static content, that is only updated whenever the app is updated?
I have some static pages (tutorial, help, contact, about, etc.) that use embedded ruby for for some things, but should otherwise be cached.
Yup. same problem for me regardless of how remember_me checkbox is checked. Permanently logged in even between browser launches unless explicitly signing out…
didn't work for me. I have a select_tag which is not part of the form. I guess that is the problem
I trying to use the dynamics search scope like this
But I'm getting wrong number of arguments (3 for 4) some help please
Love the example! I also think polling is a viable solution for many applications. Unfortunately, I'm not a big fan of coffee script so JS based episodes like these require a bit more focus on my part...but maybe that means I should start using coffee script?
What would you recommend when it comes to the /spec/vcr directory and version control?
I imagine it would be pretty safe to ignore the directory, because the cassette files would be generated on the first test run for each checkout of the repository (assuming you use record: :new_episodes)
On the other hand, if you're communicating with an unreliable server, it could be a pain to re-record the interactions correctly.
Any thoughts?
Awesome as usual. By the way i was wondering shouldn't this method CommentPoller.poll() be outside the 'if' clause because if the comments is < 0 then it will never poll again
How do you write a functional test for the login?
I'm new to Rails, and I'm having trouble figuring out how the logout link,
session_path("current")
, is routing to thedestroy
method in the controller?I use the gem s3_direct_upload inspirated by the code, but I have a problem.
Upload and progress bar works perfectly, my problem is :
The url of the uploaded file is a part a a Medium I create. The Medium contain "name", "description", "file_url" etc.
I don't display the S3 form at the creation of my medium, after saving, I redirect_to the Edit action and then display the S3 form to add a file. I tried to set post:media_url(@medium) or post:medium_edit_path(@medium) but it doesn't work cos I guess update require PUT and not POST.
So, is it possible to implement PUT with the gem or may I do something different ?
Thanks for your help
I am namespacing my concerns as demonstrated in the tutorial.
I have a class
Portrait
and a concernPortrait::ToHash
defined asbut I get this error:
superclass mismatch for class
The error goes away if I do this:
I have 5 models and I do not need to inherit the class from
ActiveRecord::Base
when defining the concern in any of the others. Just this one.Any clues what could be happening?
Great explanation of polling, thanks very much. I love how you build on extra functionality in your videos and go basic > intermediate > advanced with the extra features you keep adding on.
I thought that too, I used to do e.preventDefault() all the time until I looked up this Stack Overflow article: http://stackoverflow.com/questions/134845/href-attribute-for-javascript-links-or-javascriptvoid0
Now I just use javascript:void(0) all the time!
I concur with Kevin. I've come to Ruby & Rails with a background in other programming languages and frameworks (C, Perl, Scheme and Java). The rails API doco is somewhat half-baked, so I am very interested in deep-dive walkthroughs and I have no problem keeping up. And the pause button is there if one needs to chew on the substance a little more.
+1 on this request
This is an outstanding episode! So concise and helpful.
Just one question... One small JQuery-related thing through me for a loop.
in /app/assets/javascripts/subscriptions.js.coffee, why was the change made to:
$('#new_subscription')[0].submit()
?
What is the [0] for? I have not seen that before.
I like setting the href to 'javascript:' and skipping e.preventDefault()
Great tutorial! You can even take it a step further and only pull when the user gets down to the comments area. It's relatively easy to get info about where the browser viewport is in proportion to other elements.
It seems that indexing columns doesn´t have any effect when you are ALSO searching against associated tables
From PGSearch :
It is possible to search columns on associated models. Note that if you do this, it will be impossible to speed up searches with database indexes. However, it is supported as a quick way to try out cross-model searching.
Anyone knows about this?
+1
I'm fairly new to rails. Would someone explain why jquery plugins work normally on localhost but fail to do so when deployed to heroku
Hi!
This is most likely because of your version of Thinking Sphinx. Upgrading to 2.0.14 should fix the problem.
2.0.14 - January 2nd 2013
* Fix model loading for Rails 3.2.9 when subdirectories exist (Kenn Ejima).
https://github.com/pat/thinking-sphinx/blob/master/HISTORY
I have a question.
For the expression:
Rails.cache.fetch([:category, category_id, :name], expires_in: 5.minutes)
Why you didnt use :category_id here, why category_id do not need to symbolize, but category and name need to?
+1
I couldn't get the following to work:
I had to use:
This was on jQuery 2.1.4 with Firefox 17.0.1 and Chrome 24.0.1312.52-beta on Linux.