A fantastic screencast as always - RESTful authentication is a excellent start to an authentication system, and nice to build upon. I recently worked in role based authentication (as seen in the Rails Recipes book) into this setup with surprising ease. Which offers a great RESTful way to control access to controller/action pairs through rights and roles.
Hey, great site, thanks so much. This episode got me over the hump. One idea for a podcast might be just a simple search function by something other than the default integer ID. Most legacy systems do not have that kind of ID.
Also good to see that someone has finally made a plugin available that wraps up the Akismet functionality. For a year or so now I've been using a heavily modified version of David Czarnecki's akismet.rb to fulfil this functionality.
@mutle - In the past I've attempted to create my own spam filtering, using an interface that accepts regexps, and monitoring the performance of these to make adjustments. In the end it was a lot of work both in implementation and time to administrate. I'm tempted to have a go again though.
My mistake. It is working now. I thought I could download via svn from the command line, but I have to do so directly through the Tortoise interface instead.
Ryan, was wondering if you could describe how to differentiate the flash.now[:error] to tell the difference between an incorrect password and a user who may not have yet activated their account?
Hi, I'll work out where to send this (I guess to RO) but I thought I'd note here that the before filter method in lib/authenticated system wants to call login in the session controller, but the default routing and setup use new. So if I just bolt in the default before filter it blows up... changing it to call new makes it all go.
Anyway, thanks for another awesome screencast. It really helped me.
I'm downloading the video as i write this so i'm not sure if its covered within or not. The tests generated by the plugin use assert_difference and assert_no_difference methods not yet available on stable Rails (i've heard they are available only on edge rails).
I think you should never use IP based authentication, even if you're using only trusted addresses like 127.0.0.1, because it's possible to spoof the IP address:
http://www.securityfocus.com/infocus/1674
Also, if you're storing your password in a plain text form on a shared environment, make sure that only you have a read access to the file (chmod 600). Of course, encrypting your password is always encouraged.
Thanks for the help. It wasn't the routes that were getting me. I had some syntax problems and a general lack of understanding of MVC - but I'm on the right track now.
Hey Ryan. Another awesome railscast. And i concur with Bryce... Id watch every day if you made them!
Does anyone know of a way to automate a Rake to run nightly or based on some set interval? For some reason I have this nasty aversion to cron jobs and being able to automate a custom Rake would be insanely useful.
Steering things back on topic, I ran into an issue refactoring some helpers. Apparently any helper with the url_for method doesnt work anywhere else but the application_helper file.
I tried many different ways but Rails seems pretty unbending in this aspect.
Hi, Ryan.
I'm new to Rails, and I'm glad I found your site!
I've heard about the PeepCode podcast about RESTful development, but I was wondering if you could point me to any other resources about it.
Thanks!
@Bryce, the generator script is just a ruby class, so I'm sure there's some way to call it dynamically from other code, but I don't know how exactly.
However, I doubt it is the best solution to your problem. Very rarely should you need to generate tables and rhtml files dynamically. Instead I recommend adding another layer of abstraction, so you're adding rows to a table instead of tables to the database. You can store the contents of a template in the table row as well.
The forum would be a good place to make a thread about this so you can go into more detail on what you're trying to accomplish.
@Bryce, I think Ryan's suggestion of dropping it into a class is the best idea. Otherwise, you make something like a
system "cd #{RAILS_ROOT}; rake whatever"
though
system 'rake whatever'
might be sufficient.
That has its own problems, since it will block the entire request until that is done. An alternative would be using something like BackgroundRB or AP4R, and both requires you to run an additional server in the background.
@Bryce, good question. I don't know of a way to do this but I haven't looked into it much. If you are the author of the rake task, I recommend turning it into a class and putting it in your lib directory. Then you can use that class from both your rake task and anywhere else.
If anyone else knows a solution to this problem, please comment.
Great railscast Ryan. I miss the 3 per week fix I used to get, but still enjoy them one at a time.
Is there a way to programatically issue a rake command in a live application? There are times when I think it would be a good idea to have users invoke a generator or a rake task.
I'm guessing you're getting a no method error because I use named routes. If you take a look at the end of episode 21 (IIRC) I show the routes.rb file. Make sure to mimic this so you have the named routes.
If you still can't get it to work, I recommend posting this at railsforum.com along with the stack trace.
So sweet, I was just about to write some custom rake tasks. Thanks Ryan. This is not the first time that you've published a screencast on a topic that i'm working on. Thanks once again.
I wrote a short plugin for something kind of similar. It's parses date strings, such as "2208", "22.08/2009", "15-07" and so on.
It's pretty rough, and it does some silly things. For instance, it doesn't use Active Records validation system, it just raises stuff when things go bad.
Not on-topic, but it would be awesome if you could do a video on how to create in place editing. The Rails built-in methods are apparently being deprecated in 2.0. There evidently will (is?) a plugin alternative, but I can't find any information.
No one seems to know what the best practice is right now in terms of in-place editing. Your my hero, Ryan! :)
@john, Akismet learns as it goes, so it may have flagged your IP address as a possible spammer. That's my guess, but there could be a number of other factors coming into play.
Either way, I don't recommend testing this out because the last thing you want is to be considered a spammer by Akismet and then everything you post on other blogs will be flagged.
Ryan, I decided to test this further by pasting the same spam comments on other blogs that use Akismet such as www.techcrunch.com (wordpress blog), none of the spam comments were saved. Probably I don't understand the inner workings of Akismet but I was of the impression that it also checks for certain patterns like a high number of links in the content in order to flag it as spam, may be you could correct me on this.
I've also been having the same issues with spam on my blog, I've followed your code down to the last line and implemented it in my app. I've also tested your code by pasting in some of the spam that has hit my comment (the spam comment before this one is mine) but as you can see the spam isn't getting blocked. Please advise on way forward.
A fantastic screencast as always - RESTful authentication is a excellent start to an authentication system, and nice to build upon. I recently worked in role based authentication (as seen in the Rails Recipes book) into this setup with surprising ease. Which offers a great RESTful way to control access to controller/action pairs through rights and roles.
Hey, great site, thanks so much. This episode got me over the hump. One idea for a podcast might be just a simple search function by something other than the default integer ID. Most legacy systems do not have that kind of ID.
Good luck
i love you!
excellent work, was gonna tackle this alone this week...
now i have a podcast, ho ho ho!
;-)
good work
John.
Great screencast Ryan!
Also good to see that someone has finally made a plugin available that wraps up the Akismet functionality. For a year or so now I've been using a heavily modified version of David Czarnecki's akismet.rb to fulfil this functionality.
@mutle - In the past I've attempted to create my own spam filtering, using an interface that accepts regexps, and monitoring the performance of these to make adjustments. In the end it was a lot of work both in implementation and time to administrate. I'm tempted to have a go again though.
@taco: #length does an SQL query with AR, while #size uses the version in memory and therefore the cached number
My mistake. It is working now. I thought I could download via svn from the command line, but I have to do so directly through the Tortoise interface instead.
Great screencast. Great plugin.
I use RESTful Auth a lot and recently ran into a problem with redirects I cant seem to solve. I dont want to clutter up your comments so:
http://railsforum.com/viewtopic.php?id=8794
Ryan, was wondering if you could describe how to differentiate the flash.now[:error] to tell the difference between an incorrect password and a user who may not have yet activated their account?
@bilson, it's working for me. Is it still not working for you? Maybe Windows doesn't like the "svn" protocol. Not sure what the solution is.
Hi, I'll work out where to send this (I guess to RO) but I thought I'd note here that the before filter method in lib/authenticated system wants to call login in the session controller, but the default routing and setup use new. So if I just bolt in the default before filter it blows up... changing it to call new makes it all go.
Anyway, thanks for another awesome screencast. It really helped me.
I'm downloading the video as i write this so i'm not sure if its covered within or not. The tests generated by the plugin use assert_difference and assert_no_difference methods not yet available on stable Rails (i've heard they are available only on edge rails).
Thanks, this is the one I've been looking for. I'm looking forward the next episode on OpenID's.
Yes, k is right. For example my iTunes can't download this episode!
There is space in link to
"067_resful_authentication.mov", and some
browser have problem with download.
Use wget is solution.
I'm getting no response at all when attempting to install from this address...
svn://errtheblog.com/svn/plugins/will_paginate
Could there be a problem in Windows? I don't seem to have this problem with any other plugins?
yeah i think is a good idea too, thanks ryan :)
I think you should never use IP based authentication, even if you're using only trusted addresses like 127.0.0.1, because it's possible to spoof the IP address:
http://www.securityfocus.com/infocus/1674
Also, if you're storing your password in a plain text form on a shared environment, make sure that only you have a read access to the file (chmod 600). Of course, encrypting your password is always encouraged.
Thanks for this screencast! I just subscribed and I'm loving every episode.
@sam
Take a look at "About Railcast" for more infos about the used tools.
@James:
what is wrong with doing
<label><%= check_box_tag "product[category_ids][]", category.id, @product.categories.include?(category) %> some label</label>
this pairs a label with the checkbox.
Real good screencast. I was just wondering, what theme do you use for textmate? I've only just purchased it.
Thanks
Thanks for the help. It wasn't the routes that were getting me. I had some syntax problems and a general lack of understanding of MVC - but I'm on the right track now.
Your tutorials are great. Thanks for the help.
Hey Ryan great screencast.
I want to make a rake task to db:migrate both development and test databases at the same time
Just wondering if you know a way to call an exisiting rake task within a rake task and pass it a parameter?
This is what I have so far:
<pre>
namespace :db do
desc "Migrate development & test"
task :all do
Rake::Task['db:migrate'].invoke
end
end
</pre>
Also is there a way to pass variables in to a rake task and access them from the task?
eg
rake db:all VERSION=0
Cheers,
Josh
Hey Ryan. Another awesome railscast. And i concur with Bryce... Id watch every day if you made them!
Does anyone know of a way to automate a Rake to run nightly or based on some set interval? For some reason I have this nasty aversion to cron jobs and being able to automate a custom Rake would be insanely useful.
Steering things back on topic, I ran into an issue refactoring some helpers. Apparently any helper with the url_for method doesnt work anywhere else but the application_helper file.
I tried many different ways but Rails seems pretty unbending in this aspect.
Hi, Ryan.
I'm new to Rails, and I'm glad I found your site!
I've heard about the PeepCode podcast about RESTful development, but I was wondering if you could point me to any other resources about it.
Thanks!
@Bryce, the generator script is just a ruby class, so I'm sure there's some way to call it dynamically from other code, but I don't know how exactly.
However, I doubt it is the best solution to your problem. Very rarely should you need to generate tables and rhtml files dynamically. Instead I recommend adding another layer of abstraction, so you're adding rows to a table instead of tables to the database. You can store the contents of a template in the table row as well.
The forum would be a good place to make a thread about this so you can go into more detail on what you're trying to accomplish.
Thanks kjdash, it's fixed now.
Thank you Ryan and Ho-Sheng. If I create a class, can Rails generate new files like a generator or rake task can? (should this go to the rails forum?)
The goal is to create db tables and .rhtml files programatically on the fly.
Thanks again,
Bryce
Ryan, great screencasts!
There is a typo in the code listing for this page. You are missing a single quote in
:conditions => [name LIKE ?'
@Bryce, I think Ryan's suggestion of dropping it into a class is the best idea. Otherwise, you make something like a
system "cd #{RAILS_ROOT}; rake whatever"
though
system 'rake whatever'
might be sufficient.
That has its own problems, since it will block the entire request until that is done. An alternative would be using something like BackgroundRB or AP4R, and both requires you to run an additional server in the background.
Ho-Sheng Hsiao
Isshen, LLC
@Bryce, good question. I don't know of a way to do this but I haven't looked into it much. If you are the author of the rake task, I recommend turning it into a class and putting it in your lib directory. Then you can use that class from both your rake task and anywhere else.
If anyone else knows a solution to this problem, please comment.
Great railscast Ryan. I miss the 3 per week fix I used to get, but still enjoy them one at a time.
Is there a way to programatically issue a rake command in a live application? There are times when I think it would be a good idea to have users invoke a generator or a rake task.
Thanks,
Bryce
I'm guessing you're getting a no method error because I use named routes. If you take a look at the end of episode 21 (IIRC) I show the routes.rb file. Make sure to mimic this so you have the named routes.
If you still can't get it to work, I recommend posting this at railsforum.com along with the stack trace.
Great!
I like the ":environment" to uses AR.
task :winner => :environment do
end
Hi, I am very green. I know html and a little ruby and a little rails. I love how you set up authentication and editing on your site.
Previously I had followed a ROR tutorial to set up a blog with scaffolding but I couldn't make the next step to authentication.
I have watched episodes 19, 20, & 21 and now I want to follow your model of creating an index and referring to it in the controller.
I tried coping your code, but swapping "episode" for "post", which is what my entries are called. I came up with some missing method errors.
I know that I need to learn some more before I can make this work how I want to - can you point me in the right direction?
Thanks Ryan! So, the partial counter is just an integer. Got it!
Amazing Screencasts Ryan! Thanks for all the hard work!
So sweet, I was just about to write some custom rake tasks. Thanks Ryan. This is not the first time that you've published a screencast on a topic that i'm working on. Thanks once again.
@Umang, you can see if the current item matches "items.last":
if item == items.last
非常感谢,可以有这么好的视频来了解和学习rails
Love this one.
Are there other debugging tools for Rails?
great job Ryan
Got it. Ergo, the "create" action in the form. Thanks.
I wrote a short plugin for something kind of similar. It's parses date strings, such as "2208", "22.08/2009", "15-07" and so on.
It's pretty rough, and it does some silly things. For instance, it doesn't use Active Records validation system, it just raises stuff when things go bad.
Anyway, it sorta works =P
http://lilleaas.net/svn/plugins/date_parser/
If I use a collection. How do I know if the counter is at the last position?
agree with saket...
would be great if there is a common scenario that demonstrates the benefit of using this technique...
Not on-topic, but it would be awesome if you could do a video on how to create in place editing. The Rails built-in methods are apparently being deprecated in 2.0. There evidently will (is?) a plugin alternative, but I can't find any information.
No one seems to know what the best practice is right now in terms of in-place editing. Your my hero, Ryan! :)
@john, Akismet learns as it goes, so it may have flagged your IP address as a possible spammer. That's my guess, but there could be a number of other factors coming into play.
Either way, I don't recommend testing this out because the last thing you want is to be considered a spammer by Akismet and then everything you post on other blogs will be flagged.
Ryan, I decided to test this further by pasting the same spam comments on other blogs that use Akismet such as www.techcrunch.com (wordpress blog), none of the spam comments were saved. Probably I don't understand the inner workings of Akismet but I was of the impression that it also checks for certain patterns like a high number of links in the content in order to flag it as spam, may be you could correct me on this.
Hi Ryan,
I've also been having the same issues with spam on my blog, I've followed your code down to the last line and implemented it in my app. I've also tested your code by pasting in some of the spam that has hit my comment (the spam comment before this one is mine) but as you can see the spam isn't getting blocked. Please advise on way forward.