It seems a really small error has gone through, in the destroy method of your controller, the respond_with(@product) shall produce an error I think (as the product has just been destroyed).
Hi Ryan,
great screencast.
I'm trying to use this in combination with your recent screencast 217 multistep forms. I have a Site that has many pages.
On the first step i have the pages builder, which works fine according to this screencast. But when I return to the first step from the i.e. the second step everytime it builds more pages_fields.
Has anyone an idea?
Cheers Nick
Just to share with you, as I have spent plenty of hours figuring that. It is useful to have datepicker in date field. I have found a nice gist by @voldy. On http://blog.brzezinka.eu/webmaster-tips/ruby/ruby-on-rails-formtastic-jquery-ui-datepicker I show how to integrate jQuery UI datepicker with Ruby on Rails Formtastic gem.
For anyone having problems with Rails 3:
ActionView::Template::Error (undefined method `to_key' for #<UserSession: no credentials provided>)
this fixed the problem for me:
class UserSession < Authlogic::Session::Base
# Fix
include ActiveModel::Conversion
def persisted?
false
end
# End of fix
end
Hi, I have followed your cast but i keep getting an error when testing it in the console.
I have a user model, hotel model and relationship model. The relationship model being the look-up table. When i use the example in the the screen cast with my models then run User.all to show all users in the console i get the following error?
I've been using Prawn, but find it too time consuming. I installed PDFKIT and can run my page if I type in the URL.pdf, but when using the link_to... :format => pdf, it still launches the Prawn formatted doc.
I've removed the pdf.prawn doc, the environment.rb requirement, as well as the vendor/plugin contents, but it still launches the prawn doc. WTF?
I tried uninstalling the Prawn gem, but phusion won't start my app at all.
So...where else are these prawn files hiding that won't let PDFKIT take over?
@Wes Garrison
What about generating PDF-Report from HTML views with PDFKit.
I did some "research":
http://railscasts.com/episodes/223-charts#comment_116765
Good God! I just marked about 100 comments as spam! Seriously, at least 100.
Anyway, I'm finding Devise super frustrating as I want to tinker in the Controller with member and collection routes -- and I don't see a way to do it. If I could create my own User MVC and just add acts_as_devise in the model, then I'd be happy.
So, I'm throwing this out and going back to Authlogic. My User model isn't as trivial as it appears Devise is willing to accommodate (unless I'm missing something).
I just wanted to throw an opinion out there about the topic itself.
I've done a lot of charting for one of my projects:
* I need PDF reports, too. Javascript libraries are great for interactive in-the-page charts, but exporting them to a file and putting in a PDF isn't always the easiest.
* The google visualization API is okay, and you can grab the image from the URL and put it in a PDF.
* I like ChartDirector, easy to set up on a server, good ruby bindings and a responsive developer for questions.
Some JS libraries provide a .toPNG() function that could be used to grab the graph, so that's a possibility, but it might make more sense to use something that generates images, especially if you need crisp high-res images.
When i use Postgre as devlopment database ,Order.group("date(purchased_at)").select("purchased_at, sum(total_price) as total_price").first.total_price.to_f
will throw erro , i am just new user to Postgre, will someone help me ?
Thanks Ryan, highcharts is awesome! I have used it quite a bit in the last couple of months - in fact I made a plugin (its rough haha) but can be found here http://github.com/loudpixel/highcharts-rails.
prawn 0.8.4 has a bug for which images will overflow to the next pages.
They have submitted a fix but instructions on how to get the new changes are vague (yes, i tried to even git clone the repository and that broke my other Prawn stuff which were working fine).
Prolly need to do another video, Ryan? :)
thank you
Great screenscast!! However, I would really love to see how I can select a timeline (week, month, year, custom dates) ...
Maybe in another one. Thank you!
At New Relic, we recently started using HighCharts to replace the Flash charts that have been in use for a while.
Everyone I've talked to about the new charts really loves them and they'll soon be the default in RPM.
The ability to toggle on and off a series of data is really sweet for complex charts, and since it's just JavaScript, they work really well on the iPhone and iPad, too.
Nice webcast, There is also another library that works nice with Ruby, http://teethgrinder.co.uk/open-flash-chart-2/
The site seems to be down, however.
I will have to generate some charts in the near future. So: Thank you once more.
Since I also will have to generate PDFs from the charts and I would like to use PDFKit for it, I did a simple test. I converted examples from the mentioned libraries with wkhtmltopdf (on the commandline, no fancy rails stuff, no additional parameters).
It seems, that only Highcharts generates vector shapes. All others generate low-res images.
If someone else is interested. Here are the PDFs:
http://qooy.com/files/DBX1VHNU/chart-pdf.zip
@valley, cool, I haven't seen jqPlot before. It looks very nice. I'll add it to the links.
@Kosmas, if it always stops at 4 minutes then it sounds like a caching issue. The connection may have been dropped at that point and it continues to load from cache.
@Branden, there are a number of Rails plugins to hook into various charting libraries, but I find it often easier to interact directly with them.
I was wondering what the best way to test these controllers is when testing what happens depending whether the record is valid or not.
My best try so far:
errors = ActiveModel::Errors.new(Post.new)
errors.add_on_blank(:id) Post.any_instance.stubs(:errors).returns(errors) Post.any_instance.stubs(:valid?).returns(false)
@Renato, did you mean the respond_to method that takes these options?
I think you're overdoing it with this one. More code, no gain at all. Just more obfuscation.
respond_with accepts :only and :except options as well.. :)
you can use it for specific actions.. that's the only thing I missed on the video
great work man
Thanks a lot for the screecasts.
It seems a really small error has gone through, in the destroy method of your controller, the respond_with(@product) shall produce an error I think (as the product has just been destroyed).
That aside, you really rock!
Regards
Brilliant Ryan, thank you very much!
Have you also looked into José Valim's work on Inherited Resourses. I'd love to see you do something on that theme also.
Keep up the top work!!!
D.
Hi Ryan,
great screencast.
I'm trying to use this in combination with your recent screencast 217 multistep forms. I have a Site that has many pages.
On the first step i have the pages builder, which works fine according to this screencast. But when I return to the first step from the i.e. the second step everytime it builds more pages_fields.
Has anyone an idea?
Cheers Nick
Please note that Metal is deprecated and removed since Rails 3.0.0.beta4.
https://rails.lighthouseapp.com/projects/8994/tickets/4889-rails-300beta4-metal-absent
respond_with(@awesomeness)
Thanks for the casts Ryan. They are always appreciated.
Just to share with you, as I have spent plenty of hours figuring that. It is useful to have datepicker in date field. I have found a nice gist by @voldy. On http://blog.brzezinka.eu/webmaster-tips/ruby/ruby-on-rails-formtastic-jquery-ui-datepicker I show how to integrate jQuery UI datepicker with Ruby on Rails Formtastic gem.
This may be a Rails 3 issue, but my db would not interpret the date format "mm/dd/yyyy" as Ryan's did. I revised my js to be as follows:
$(function() {
$("#model_field").datepicker({
dateFormat: 'yy-mm-dd'
});
});
This appears to have fixed the issue. Thanks for the screencast!
For anyone having problems with Rails 3:
ActionView::Template::Error (undefined method `to_key' for #<UserSession: no credentials provided>)
this fixed the problem for me:
class UserSession < Authlogic::Session::Base
# Fix
include ActiveModel::Conversion
def persisted?
false
end
# End of fix
end
Хороший сайт. Всегда актуальные новости. Буду заходить почаще.
Hi, I have followed your cast but i keep getting an error when testing it in the console.
I have a user model, hotel model and relationship model. The relationship model being the look-up table. When i use the example in the the screen cast with my models then run User.all to show all users in the console i get the following error?
http://pastie.org/1059009
Models
http://pastie.org/1059011
ideas anyone?
another source to add to your list is DHX:
http://www.dhtmlx.com
thanks for post. nice.
How to parse custom feed attributes? There is a way to do that for entries using
Feedzirra::Feed.add_common_feed_entry_element("wfw:commentRss", :as => :comment_rss)
But I want the same feature for the feed object, not just its entries. Is there a way to do that? Like say
Feedzirra::Feed.add_common_feed_element("geo:lat", :as => :latitudes)
Help!
There are a way to concat 2 where clauses with OR operator? Like Post.where("name = 'foo'") | Post.where("name = 'bar'") ?
Simply brilliant! Thanks for yet another very useful and enlightening Railscasts.
I've been using Prawn, but find it too time consuming. I installed PDFKIT and can run my page if I type in the URL.pdf, but when using the link_to... :format => pdf, it still launches the Prawn formatted doc.
I've removed the pdf.prawn doc, the environment.rb requirement, as well as the vendor/plugin contents, but it still launches the prawn doc. WTF?
I tried uninstalling the Prawn gem, but phusion won't start my app at all.
So...where else are these prawn files hiding that won't let PDFKIT take over?
@Wes Garrison
What about generating PDF-Report from HTML views with PDFKit.
I did some "research":
http://railscasts.com/episodes/223-charts#comment_116765
Good God! I just marked about 100 comments as spam! Seriously, at least 100.
Anyway, I'm finding Devise super frustrating as I want to tinker in the Controller with member and collection routes -- and I don't see a way to do it. If I could create my own User MVC and just add acts_as_devise in the model, then I'd be happy.
So, I'm throwing this out and going back to Authlogic. My User model isn't as trivial as it appears Devise is willing to accommodate (unless I'm missing something).
I just wanted to throw an opinion out there about the topic itself.
I've done a lot of charting for one of my projects:
* I need PDF reports, too. Javascript libraries are great for interactive in-the-page charts, but exporting them to a file and putting in a PDF isn't always the easiest.
* The google visualization API is okay, and you can grab the image from the URL and put it in a PDF.
* I like ChartDirector, easy to set up on a server, good ruby bindings and a responsive developer for questions.
Some JS libraries provide a .toPNG() function that could be used to grab the graph, so that's a possibility, but it might make more sense to use something that generates images, especially if you need crisp high-res images.
I used used this rails plugin
http://github.com/Bantik/seer
It's another wrapper for the Google Visualization API. Works great.
In rails 3 inside a controller the @template variable is nil...
eat website,have very interested articles ,i have visit 'em
It is really a gud job!!. Keep on increasing my rails learning curve through RailsCasts. Thanks to Ryan Bats
It is a nice recipes.
When i use Postgre as devlopment database ,Order.group("date(purchased_at)").select("purchased_at, sum(total_price) as total_price").first.total_price.to_f
will throw erro , i am just new user to Postgre, will someone help me ?
Ryan,
FYI: Mike Nelson has implemented a Highcharts Prototype adapter.
http://github.com/mnelson/Prototype-Highcharts-Adapter/blob/master/highcharts-adapter.js
anyone notice that Ryan pronounces "boolean" as "boo-LEEN" instead of "boo-lee-UHN"? too cute.
Thanks Ryan, highcharts is awesome! I have used it quite a bit in the last couple of months - in fact I made a plugin (its rough haha) but can be found here http://github.com/loudpixel/highcharts-rails.
Thanks for this Ryan! Seeing it is so easy, maybe i am going to put this in some projects of mine.
I think railscasts.com is so usefull for this, showing the people all different kind of tactics and solutions to fix problems.
Thanks a lot!
Hey Ryan - as always a great cast :D
Lately I was refactoring the google_visualr rails plugin - a ruby wrapper for the google visualization api.
a gem could come up soon - clone the code from http://github.com/msalzburg/google_visualr
prawn 0.8.4 has a bug for which images will overflow to the next pages.
They have submitted a fix but instructions on how to get the new changes are vague (yes, i tried to even git clone the repository and that broke my other Prawn stuff which were working fine).
Prolly need to do another video, Ryan? :)
thank you
Great screenscast!! However, I would really love to see how I can select a timeline (week, month, year, custom dates) ...
Maybe in another one. Thank you!
At New Relic, we recently started using HighCharts to replace the Flash charts that have been in use for a while.
Everyone I've talked to about the new charts really loves them and they'll soon be the default in RPM.
The ability to toggle on and off a series of data is really sweet for complex charts, and since it's just JavaScript, they work really well on the iPhone and iPad, too.
@dtolj, I just noticed this in highchart's demo's:
http://www.highcharts.com/demo/?example=dynamic-update
Looks like the demo is just generating random points, but you may be able to tweak it for your needs.
I have a database table which is updated every 10sec, would love to see a dynamically updated page that keeps the graph information up to date.
Nice webcast, There is also another library that works nice with Ruby, http://teethgrinder.co.uk/open-flash-chart-2/
The site seems to be down, however.
I will have to generate some charts in the near future. So: Thank you once more.
Since I also will have to generate PDFs from the charts and I would like to use PDFKit for it, I did a simple test. I converted examples from the mentioned libraries with wkhtmltopdf (on the commandline, no fancy rails stuff, no additional parameters).
It seems, that only Highcharts generates vector shapes. All others generate low-res images.
If someone else is interested. Here are the PDFs:
http://qooy.com/files/DBX1VHNU/chart-pdf.zip
Not sure if its my setup: Ubuntu 9.10, but playing this with VLC 1.0.2 I keep getting glitches.
Apart from that, thanks Ryan, great railscast.
@Ryan, what do I do if I need a nested controller like
"Admin::Home"
What would has_permission_on look like? (:admin_home?)
Unfortunately just too late; I just finished a project in which this would have been very useful!
Thanks again Ryan for another great and informative railscast. Looking forward to playing around with the graphing libraries.
"Railscasts make Mondays worth looking forward to!"
I like so much how javascript libraries coming to be nice DSL's.
Thank you for this cool railscast!
Hi Ryan!
Have you ever met FusionCharts Free http://www.fusioncharts.com/free/ ?
i've used jqplot before and it's really easy to customize. and thanks Ryan for this other option. :D keep this up!
@mikhailov, @Aaron, thanks, fixed!
@valley, cool, I haven't seen jqPlot before. It looks very nice. I'll add it to the links.
@Kosmas, if it always stops at 4 minutes then it sounds like a caching issue. The connection may have been dropped at that point and it continues to load from cache.
@Branden, there are a number of Rails plugins to hook into various charting libraries, but I find it often easier to interact directly with them.
There went ColdFusion developers' last excuse (cfchart) to switch to Rails. :-)
Hi Ryan, thank you very much for the mention of lazy_high_charts
best regards