RailsCasts Pro episodes are now free!

Learn more or hide this

Recent Comments

Avatar

i use Google Visualization to generate my charts, http://code.google.com/apis/visualization/documentation/gallery.html

Javascript API.

Very nice railscast.

Avatar

Thanks for the cast. I'm doing what you do but my form is not showing up. Also not in HTML. I don't use the projects_path but :controller => 'projects' :action => 'search' in stead. Is that the problem?

Rutger

Avatar

So I guess their aren't to many rails charts available eh? I guess it makes more sense that javascript handles this because of the animation involved but it would be nice to have a rails option where you can simply hook into jquery or something to spice it up.

Avatar

i use xml/swf charts ( http://www.maani.us/xml_charts/ ) and it's good too (there is a plugin too for rails)

Avatar

Google chart api is pretty nice too
http://code.google.com/apis/charttools/index.html

Avatar
Kosmas Chatzimichalis on #223 Charts 2010-07-19 05:15:05

Great one as usual Ryan,

Thank you.

Just a small note about a problem with my firefox playing the video, and don't know if anyone else had that.
My firefox stops playing the video about 4 minutes before the end, just before displaying the console with all the different queries.
It's playing fine when I download it on my pc, and cannot remember having a similar problem with previous episodes.

Thanks again for the episodes Ryan.

Avatar

Hi Fredrik,

to add page numbers, you can add some spans to the header HTML that will be replaced, see: http://madalgo.au.dk/~jakobt/wkhtmltopdf-0.10.0_beta4-doc.html#Headers%20And%20Footer%20Options. Setting the header is easier using wicked_pdf.

Avatar

I like jqPlot. Nice plugin architecture which can easily be extended.
The forum response is also quite good: http://www.jqplot.com/

Avatar

The domain in the link seems to be a typo.

I'll have to check this one out :).

Avatar

resources: http://railcsasts.com/episodes/205-unobtrusive-javascript isn't valid link, please fix it

Avatar

I've had trouble trying to get this to work on Heroku too, was working before a few days ago.

I've used Dan's code (Comment #128) which stops the crop from breaking but the aspect ratio is not being kept correctly.

Previously I was using Key Mayer's change (Comment #60), appending a bang on the end of the command, which was working but isn't working anymore.

Avatar

In rails 3, i had to change the protect_from_forgery call to: skip_before_filter :verify_authenticity_token, :only => [:create]

Avatar

Cracking screencast, thanks. I just used metal to load Nesta (a Sinatra CMS) into the same process as a Rails 2.3 app.

I'm sure I wouldn't have found out how to do it so smoothly if I hadn't watched this.

Avatar

Thanks for this post, but it don't work for ActionMailer.

Here my path:
http://gist.github.com/478169

Avatar

I was hoping to see controller customization also, but otherwise I loved it. Thanks so much!

Avatar

With table_builder, if you get undefined method `strftime' for 0:Fixnum or the like (might be a Postgres issue), be sure to return a date from your :day_method, like so (in your model):
task.rb
def deadline_date
    self.deadline ? self.deadline.to_date : nil
  end

Avatar

If you want to use this technique with heroku (and the S3) you'll need this gist instead:

http://gist.github.com/477586

The command needs to be an array for reasons unknown to me.

Avatar

I haven't tested Rails Metal yet but I know that this would be a good resource when the time comes.

Thanks!

Avatar

Has anyone been able to solve the 406 error on Rails 2.3.8 ?

Avatar

What's the difference between the return_url and notify_url?
The return_url was demonstrated in the previous episode but why can't the notify_url be shown working in this episode, with localhost? Wouldn't Paypal be doing the same thing for both - FORM HTTP POST?

Avatar

Hey Ryan,

<obligatory praise>Excellent work on the screencasts - I think it's fair to say I would have given up on RoR in the first few weeks if it wasn't for your selfless work. Keep it up!</obligatory praise>

My question relates to the registration process.

Would it be possible to have the user simply submit their e-mail address as a unique identifier, and then change the confirmation e-mail to take you to a page where you then set up your password, first name, last name etc?

It's a registration method that I've only seen implemented a couple of times, but seems to make much more sense to me, as it makes the signup process appear much simpler to the user.

I've looked up the documentation on :activatable, but it's pretty thin on the ground.

A simple yes/no answer would suffice, but if you could at least give me some pointers as to how to start implementing it, i'd be eternally grateful.

If you could do a whole screencast on it, I'll name my first born after you :)

Avatar

SOLVED.
Do not try to do this on a Mac unless you are on OSX 10.6.x I tried RVM and rails on 10.5 and had major headaches.

Avatar

For everyone getting only "nil" rendered, check your logs. Likely it will say it want's a genereic template such as show.erb.
The patch quoted above which is at http://github.com/perenecabuto/PDFKit/commit/c61f8d683c2894c2cfecf08b43707c63514c4c9f
might work but it's not yet in the master branch AFAICT.

Avatar

Hi. This was a great help. Thanks for that. Just one little problem that I am facing. The second drop down list that is displayed, is not sorted. I want to sort it alphabetically. Right now, it sorts it by id. Any ideas?

Thanks.

Avatar

I'm getting funky error output (not matching yours). cucumber seems to be suppressing the errors? See http://stackoverflow.com/questions/3232856/cucumber-errors-suppressed-not-displayed-fully for full details.

Any suggestions?

Avatar

I have a doubt.

Suppose I want to make the crop in only two styles (:small, :large) and a third (:medium) I just wanted to use the resize without crop.

How can I do this?

Thanks for the great tutorial!

http://pastie.org/1041573

Avatar

How would you do authentication / authorization for embedded apps??

Avatar

Great screencast as usual, thanks Ryan !

On Mac OS X, "*.127localhost.*" resolves to 127.0.0.1 too: it's really helpful to test applications against both subdomains and TLDs.

Avatar

Great Railscast. I followed the instructions and installed RVM and Ruby 1.9.1 and followed the rest of the instructions.

I created a new rails project called topscore
I installed: gem install sqlite3-ruby
when i try rails server i always get this error

sqlite3-ruby-1.3.1 is cached, but not installed.
Try running `bundle install`.

and i get an error when installing the sqlite3-ruby gem

this also happens on ruby v 1.9.2
any clues?
thx!

Avatar

Hi Ryan, I am using rails 3 and trying to use paper clip cropper but it is giving below error;
NameError (uninitialized constant Paperclip::Cropper)

I tried to do this with the help of http://asciicasts.com/episodes/182-cropping-images

Avatar

just learn how to code like pro in pure Javascript then you would not need buggy heavy slow frameworks.... and you control you own destiny and you can enjoy the power of knowing

Avatar

I just get an error...

uninitialized constant Subdomain (NameError)

Avatar

I just figured out how to get this working and blogged about it a couple of days before you did this! I like your solution more though. In case anyone is interested, I also blogged about how to test it with cucumber/capybara: http://mattbeedle.com/2010/07/04/testing-subdomains-with-cucumber-cabybara-and-rack-test

Avatar

This was great!, I made some modifications in the routes.rb (rails 3) to handle a default page for root:

 match '/(:permalink)' => 'pages#show', :permalink => 'presentacion'

The default page will be "presentacion" id...

Cheers.

Avatar

All I'm looking for a site on a very large and beautiful on this site are subject to all of you very
Thanks

Avatar

yes, I'm looking for a site on a very large and beautiful on this site are subject to all of you very
thanks

Avatar

Hi there,

Great tutorial:)
I just tried it, but cause an error on mine:

"undefined method `normalize_identifier' for OpenIdAuthentication:Module
"

Am I miss something here?

Thanks
 

Avatar

simple. now there is a gem for prawnto plugin. install it as always.

1. gem install prawn #this will install prawn 0.8.4 -core, -layout, -security
2. gem install prawnto #this will install prawnto 0.0.1

3. in environment.rb file write dependency to this gems:
  config.gem "prawn"
  config.gem "prawnto"

4. in the controller action you must specify format.pdf in respond_to method. ie. controller action is show as railcast. you must put something like.
  def show
   @order = Order.find(params[:id])
   respond_to do |format|
     format.html
     format.pdf {:render => false }
   end
  end
5. Create your view as shown in railcast. name_of_action_view.pdf.prawn

I hope it helps someone.

Avatar

Great, plug-in/gem, Ryan.

Now, is it just me, or is the matching_can_definition() method in the Ability module doing the wrong thing by traversing the rules in reverse order?

I mean, shouldn't it traverse the can definitions in the order they were declared in the Ability#initialize method?

Avatar

hi Ryan
can u please tell me how to use prawn with UTF-8 support.
 

Avatar

I made a gem called basic_model, based on this approach:

http://github.com/petebrowne/basic_model
http://rubygems.org/gems/basic_model

Avatar

Thank god for the creation of ryanb ! ;) you save my ass every time, bro.

Avatar

If you have to deal with various top level domains and third level assignments in parallel (.e.g. some have .com, some others co.uk) you may want to use the public suffix library from:

http://www.simonecarletti.com/blog/2010/06/public-suffix-list-library-for-ruby/

This is far better than hardcoding the length in your app and also used by browser vendors already.

hth,
Roland

Avatar

Hi. I'm new to Rails and even new to programming so this might seem trivial to you. I'm using the calendar_for plugin and would like to use it for a sort of a diary. So, for each day, there is only one post. I would like to fill the calendar with links to these posts but if there's no post for a certain date, a link to new_post. I just can't get it right and end up with links to new_posts for all days in addition to the links to existing posts. Any hints or tips?
Thanks!

Avatar

It couldn't have been done better. From a noob point of view, its a gem. Though my needs didn't exactly fit with the example, a peek at the documentation gave me what i wanted. Nice work!

Avatar

I think

constraints(Subdomain) do
  match '/' => 'blogs#show'
end

can be even shorter, like

constraints(Subdomain) do
  root :to => 'blogs#show'
end

Avatar

no worries, i figured out the problem. thanks again ryan! great videos!