I just setup ActiveMerchant with PayPal Website Payments Pro (US) to do recurring payments for a project I'm working on. If anyone wants to see how I wrapped the PayPal recurring API resources, I posted it all on my blog:
I know this is years too late. But I was wondering if you could clear up Gabriel Mansour and Mo Rashed's questions (comments 10 and 11 respectively) It's just that those are exactly the two things I was scratching my head over.
In Rails 3.0.0.rc there seems to be an issue using :domain => :all - it flips out with an InvalidAuthenticityToken error. Using :domain => ".smackaho.st" works for the time being.
Per https://rails.lighthouseapp.com/projects/8994/tickets/5147-the-all-domain-option-for-the-cookie-session-store-doesnt-allow-non-standard-tlds-like-local-or-couk
Railscast's recent videos plays problematically on my machine (VLC 1.1.1 on Ubuntu). Could you provide other more open video formats besides Quicktime? Thank you.
Have been tinkering with thinking sphinx but that might be overkill on the project i am currently working on. The only reservation I have about searchlogic is that the owner of the project wants clean urls, searchlogic doesnt seem to have this on first look. Any ideas for cleaning up the urls?
Thanks helmerj for the fix for Rails3.rc. However, it only works for adding new fields. It seems Rails3rc busted the 'remove' functionality in this nested model example. Any idea how to fix?
@bingobob: I was also concerned that every page can be rendered as .pdf. I only have one page that makes sense. Instead of doing the middleware step, I think I can just call: `wkhtmltopdf --page-width 8.5in --page-height 11.0in http://my.domain.com/my/url output.pdf` from my controller in the one place it is needed.
Thanks for the great plugin, i have watched the vedio and i have tried to use cancan but i keep getting a "wrong number of arguments (1 for 0)" when i try to use the can? or load_and_authorize_resource
what could be the problem? i used them the same way you did.
Hi, i'm trying to lern rails. In this episode there where some lines of code which I didn't understand. Can anyone give me link to a manual or tutorial where I can read about following lines of code?
I had no clue you could do 'redirect_to [:edit, @object]'. This is so much more concise than writing out 'redirect_to edit_object_path(@object)' in my opinion, especially when it comes to nested routes. Great episode :)
Im getting an error with the setter method "Could not find the association "taggings" in model Article". I think something wrong with "Article has_many :tags, :through => 'taggings'", but how to correct this, Please help thx
I encountered 3 problems when I tried Paperclip + jcrop.
1. Paperclip has a dependency on ImageMagick, so you do have to install that first. http://www.imagemagick.org/
2. I'm using rails3 beta4, and papercli 2.3.3, when I created the Cropper class, it seems that it can't be auto-loaded. So if you have the same problem maybe you just need to require it explicitly.
3. You need to change the Cropper class because maybe there're some changes happened to paperclip so that neither Ryan or rjcrop's code will produce an error now. You can use 62.@Chris Your's code, thank you @Chris Your btw. If you use heroku or S3 so maybe you should check 65@Dan Hixon's code.
@ lunas I had the same error. I was using rails3 beta4, and I'm sure I created the correct Cropper class under the lib folder, but still got error. I think it might me some bugs that the Cropper class just can't be auto-loaded. So require it explicitly may solve the problem, though it's not a permanent way but still worth it because you can move on.
With the routes, my named route only works if I put it right at the top, otherwise it says "undefined method"; I need to put something above it otherwise it wrecks the program, but the named route doesn't work with anything above it (although nothing is "overwriting" it); how do I fix this?
One thing that drives me nuts about the flash is that is sticks around until the next page is loaded.
For example, I like having a single/format for my flash messages and I use them for confirmation messages when CRUD'ing.
However if a user fails to save a record then the page is not redirected but a render event is called instead. This means that the flash is nicely displayed on the current error page but it ALSO sticks around for the next page (Where it isnt correct). I keep having to manually delete the flash whenever an action fails (after the render call) so that it isn't carried on to the next page.
If anybody else has the "There was a problem with the decryption of your secure order" issue on PayPal, this fixed it for me:
https://www.x.com/message/161715#161715
From that post:
******************************
The 'cmd' parameter must be "_s-xclick" in the non-encrypted form, but it must also be included in the encrypted blob, as "_xclick" (or, presumably, any of the other values except "_s-xclick".)
Paypal appears to decrypt the form when it's told to handle the s-xclick, and then forwards the unencrypted details to a separate controller, which needs to know the cmd as well.
Bryan, for respond_with you removed the HTML specific part - but you left the flash[] in there? So what happens when an XML request is served? The flash is set but it's useless for XML, so it is delivered with the next HTML request, to which it does not belong? Or what am I missing?
Excellent episode Ryan. Looking forward to next week! Will look to upgrade one of my apps in the weeks to come. Many thanks.
Also having VLC problems on OS X.
Hello.
is there anyway to close automatically the shell in Windows after the rake task is executed?
Thanks.
I had some problems installing ruby with rvm (readline issue), but after tackling that, this episode was realy helpful, thanks!
I just setup ActiveMerchant with PayPal Website Payments Pro (US) to do recurring payments for a project I'm working on. If anyone wants to see how I wrapped the PayPal recurring API resources, I posted it all on my blog:
http://blog.matthodan.com/how-to-add-support-for-paypal-website-payment
Hi
great post! but i have a problem, i cant view a image once its uploaded, it says "Missing" in the place of where the photo is meant to be.
what could be the problem?
Hello Ryan,
I know this is years too late. But I was wondering if you could clear up Gabriel Mansour and Mo Rashed's questions (comments 10 and 11 respectively) It's just that those are exactly the two things I was scratching my head over.
Thanks,
Matt
BTW, I had no problems on Ubuntu with Totem player. And here on Mac I found Grapher, it also shows video fine.
In Rails 3.0.0.rc there seems to be an issue using :domain => :all - it flips out with an InvalidAuthenticityToken error. Using :domain => ".smackaho.st" works for the time being.
Per https://rails.lighthouseapp.com/projects/8994/tickets/5147-the-all-domain-option-for-the-cookie-session-store-doesnt-allow-non-standard-tlds-like-local-or-couk
Just a note that you can point to the Rails 3 branch of will_paginate...
gem 'will_paginate', :git => "http://github.com/mislav/will_paginate.git", :branch => "rails3"
I also have video problems on vcl mac os x.
Railscast's recent videos plays problematically on my machine (VLC 1.1.1 on Ubuntu). Could you provide other more open video formats besides Quicktime? Thank you.
I am apreciating it very much.I have never read such a lovely article and I am coming back. Site dizin olarak elimizden geleni yapalım
For those who is working on Windows development, you may face "identify" problem.
Please try to change
command = %Q[#{path_for_command(cmd)} #{params}]
to
command = %Q[#{path_for_command(cmd)} #{params.gsub("'",'"')}]
Hey Guys,
Have been tinkering with thinking sphinx but that might be overkill on the project i am currently working on. The only reservation I have about searchlogic is that the owner of the project wants clean urls, searchlogic doesnt seem to have this on first look. Any ideas for cleaning up the urls?
Stu
Thanks for this Cast, that makes my change to rails 3 quite easier!!!
Great Screencast in a perfect moment
Thx
Can you show the appropriate changes in the application templates too (gems, routes, changed commands)
thank youuu
Thanks helmerj for the fix for Rails3.rc. However, it only works for adding new fields. It seems Rails3rc busted the 'remove' functionality in this nested model example. Any idea how to fix?
As far as I know there is a polymorphic paperclip plugin. Maybe that's what you are looking for, Alex.
I liked paperclip plugin, but I need to sort out what to do with many attachments.
@bingobob: I was also concerned that every page can be rendered as .pdf. I only have one page that makes sense. Instead of doing the middleware step, I think I can just call: `wkhtmltopdf --page-width 8.5in --page-height 11.0in http://my.domain.com/my/url output.pdf` from my controller in the one place it is needed.
thanks for the post. I'm using the new BBQ library and that's also very easy to use.
If you get the error
uninitialized constant Subdomain (NameError)
it seems that in the later versions of the Rails 3 beta or the edge version the routes file doesn't autoload /lib/subdomain.rb
Adding
require 'subdomain'
before the routes block fixes this.
This is my way how I've got rid of "not recognized by..." Just adjust the validations a bit.
file_types = ['image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/pjpeg']
validate do |image|
image.errors.clear
image.errors.add_to_base("File missing") if image.file_file_name == nil
image.errors.add_to_base("Wrong format") unless file_types.any? { |type| type == image.file_content_type }
image.errors.add_to_base("Wrong size") if image.file_file_size != nil && image.file_file_size > 2.megabytes
end
Thanks
Just thanks, nice job.
HI
Thanks for the great plugin, i have watched the vedio and i have tried to use cancan but i keep getting a "wrong number of arguments (1 for 0)" when i try to use the can? or load_and_authorize_resource
what could be the problem? i used them the same way you did.
Hi, i'm trying to lern rails. In this episode there where some lines of code which I didn't understand. Can anyone give me link to a manual or tutorial where I can read about following lines of code?
1:
<%= render :partial => "#{@order.current_step}_step" %>
What does #{} mean? Is it ruby syntax?
2:
%w[shipping billing confirmation]
I'd like to know why there is a % sign and why there are no "," between these entries.
wouldn't it be something like:
steps = [shipping, billing, confirmation] ??
I'm really at the beginning and sometimes having problems to figure out if anything new is ruby, rack, rails and so on.
So links to specific manuals would be nice.
Thanks for these episodes!
Much love from Germany
Хороший сайт. МАПС
Thanks for article. It's very interesting.
Anyone written that rake task to email the "other" beta users from the signup page?
I had no clue you could do 'redirect_to [:edit, @object]'. This is so much more concise than writing out 'redirect_to edit_object_path(@object)' in my opinion, especially when it comes to nested routes. Great episode :)
I got a question here, how to do this tagging thing with a polymorphic association? for example:
Article has_many :taggings, :as => 'taggable', :dependent => :destroy
Article has_many :tags, :through => 'taggings'
-------------------------------
Taggings belongs_to :taggable, :polymorphic => true
Taggings belongs_to :tags
-------------------------------
Tag has_many :taggings
Im getting an error with the setter method "Could not find the association "taggings" in model Article". I think something wrong with "Article has_many :tags, :through => 'taggings'", but how to correct this, Please help thx
I encountered 3 problems when I tried Paperclip + jcrop.
1. Paperclip has a dependency on ImageMagick, so you do have to install that first. http://www.imagemagick.org/
2. I'm using rails3 beta4, and papercli 2.3.3, when I created the Cropper class, it seems that it can't be auto-loaded. So if you have the same problem maybe you just need to require it explicitly.
3. You need to change the Cropper class because maybe there're some changes happened to paperclip so that neither Ryan or rjcrop's code will produce an error now. You can use 62.@Chris Your's code, thank you @Chris Your btw. If you use heroku or S3 so maybe you should check 65@Dan Hixon's code.
@ lunas I had the same error. I was using rails3 beta4, and I'm sure I created the correct Cropper class under the lib folder, but still got error. I think it might me some bugs that the Cropper class just can't be auto-loaded. So require it explicitly may solve the problem, though it's not a permanent way but still worth it because you can move on.
Great screen cast but I agree with the other guys about the database design being bad. Definitely fine for really simple purposes, but it's not scalable. I wrote a post on how to set up Devise and CanCan, while implementing the typical User HABTM Role relationship. Would love everyone's feedback. Here is the link - http://www.tonyamoyal.com/2010/07/28/rails-authentication-with-devise-and-cancan-customizing-devise-controllers/
Great Railscast!
Question: Are you using TextMate for your editing? What bundles do you have installed for the "ife" shortcut and the other HTML shortcuts?
I have the Ruby On Rails bundle installed, but all the shortcuts don't seem to work.
Thx Ryan for another nice screencast.
I can only recommend using http://rufus.rubyforge.org/rufus-scheduler/
This has by far the best integration into rails that I know...
For the latest Rails3.rc ONe has to modify a single line:
in "module ApplicationHelper"
link_to_function(name, "add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")")
which removes the not needed h() function.
Otherwise works like charm. No I have to make this work using paperclip file fields...
With the routes, my named route only works if I put it right at the top, otherwise it says "undefined method"; I need to put something above it otherwise it wrecks the program, but the named route doesn't work with anything above it (although nothing is "overwriting" it); how do I fix this?
Nice work btw,
Thanks In Advance,
Joe
One thing that drives me nuts about the flash is that is sticks around until the next page is loaded.
For example, I like having a single/format for my flash messages and I use them for confirmation messages when CRUD'ing.
However if a user fails to save a record then the page is not redirected but a render event is called instead. This means that the flash is nicely displayed on the current error page but it ALSO sticks around for the next page (Where it isnt correct). I keep having to manually delete the flash whenever an action fails (after the render call) so that it isn't carried on to the next page.
Thanks Ryan, love your site.
I'd never use this though. What's wrong with a bit of code repetition within the same method?
Once the search code is out of your controller and in your model, that's good enough, you've done well.
Imagine having to work on a project that's full of little "optimizations" like this, you would go crazy.
If anybody else has the "There was a problem with the decryption of your secure order" issue on PayPal, this fixed it for me:
https://www.x.com/message/161715#161715
From that post:
******************************
The 'cmd' parameter must be "_s-xclick" in the non-encrypted form, but it must also be included in the encrypted blob, as "_xclick" (or, presumably, any of the other values except "_s-xclick".)
Paypal appears to decrypt the form when it's told to handle the s-xclick, and then forwards the unencrypted details to a separate controller, which needs to know the cmd as well.
Nice screencast, it made me swap my charts in a current project from Seer to Highcharts.
Does anybody have an idea how to group the data by year|month|week instead of day?
Well should have done my research properly...
The custom validators have to go here:
app/validators
Cheers J
The custom validator used here to validate an email address does not work in the just released rc of rails3:
Unknown validator: 'email_format'
So stuff in RAILS_ROOT/lib does nto get loaded I suppose...
Anybody know how to solve this?
Bryan, for respond_with you removed the HTML specific part - but you left the flash[] in there? So what happens when an XML request is served? The flash is set but it's useless for XML, so it is delivered with the next HTML request, to which it does not belong? Or what am I missing?
Speaking of respond_with - What do you think about putting it in an after_filter to avoid duplication?
Here is a blog post on how to get Metal-like application enabled in a new Rails3 app:
http://tektastic.com/2010/07/rails3-rack-and-where-did-my-metal-go.html