Great screencast as usual. I have learned so much from your podcasts that my rails abilities have improved considerably.
Unfortunately, the will_paginate plugin won't work with my version of rails (1.2.3). I'm not able to start mongrel, as I get "finder.rb:11:in `included': undefined method `alias_method_chain'". Shame as I really want to use it for an artists website that I'm redesigning.
thanks for pointing the way to will_paginate. however, i was trying to implement it to paginate "entries" that works with the "acts_as_taggable" plugin. i placed this in the entry model.
Hi, I'm the main maintainer for the will_paginate plugin. Ryan, thanks a lot for this screencast! For the rest of you, you can get familiar with the plugin by generating the RDoc documentation; simply type "rake rdoc" while in the plugin directory.
If you want to report bugs or suggest features for this plugin, go to http://err.lighthouseapp.com/projects/466-plugins. Thanks!
Is it wrong that I was giddy like a small child on Christmas day when I saw the new Railscast in my iTunes Podcasts directory? Thanks for all your awesome work on these podcasts!
Lisa - it's pretty easy to write a helper to do your AJAX pagination. There's a good example in the (awesome) exception_logger plugin. It's designed for classic pagination, but something like this would work for will_paginate, too. Check it out: http://svn.techno-weenie.net/projects/plugins/exception_logger/lib/logged_exceptions_helper.rb
@Joe, good question. If you want the user submitted date to stick around for an invalid entry you should store it in an instance variable in the setter method. Then read from that instance variable in the getter method if it's set. You can see the code here:
@lisa, nope, AFAIK will_paginate doesn't offer anything special in regards to AJAX. You can still use the back end part of the plugin to manage the pagination, however, you may need to rewrite the view portion to use link_to_remote instead of normal links.
Ryan, When entering an invalid date and the form is redisplayed with the error, the invalid date string is lost and replaced with the old date value. What would be the best way to keep the text value that the user entered so they can more easily see and correct their mistake?
For perfection:
Contest image tag should end with />.
Somewhy hidden input fails too in validator. Maybe someone can explaink, why hidden input needs to be in div or p tag too?
Congratulations on number 50, Ryan!
Next time I stumble upon some missing documentation, I will commit a patch, now that I know how easy it is.
Thanks a lot for demystifying this topic!
script/console isn't being "flaky" -- I believe the reason why your "name" method on your project didn't autocomplete until you accessed it because the method is created in the class by ActiveRecord::Base when it notices it doesn't exist (through a call to method_missing) See ActiveRecord::Base define_read_methods.
@bradc, good question. There's no way to override the default :order by passing the options. To change this behavior you need to reverse it so the :order statement is in with_scope and the options are passed directly to the find method.
@Jack, for information on doc patches the best place to go is railsdocumentation.org. There's not much activity yet because it just started, but there's some very knowledgeable people there. I recommend asking your question on their google group.
Also, doc patches don't need to be elaborate, simple grammar/spelling fixes are fine.
I was wondering if there was a place were people could request improvements. (sort of like how Wikipedia pages might have a "The needs further documentation" type message at the top) If not are there any other suggestions for newer people (like myself) as to where to start for needed doc patches?
Thanks and Congrats Ryan on the success of Railscast.
The "yield" call in a layout will output the contents of the template. When supplying a parameter (:head in this case) it will output the contents of that content_for block. I explained this in the episode, sorry if it wasn't clear.
@Brian, I recommend asking your questions over at railsforum.com. That way it will be easier to post code samples and ask more detailed questions. I visit there frequently so hopefully I can get around to answering you there. Thanks.
Awesome screencast - Ryan you absolutely rock! Doing this live, seeing how easy it was (give or take a few prerequisites), made my day... I've been thinking about fixing all the typos in the docs for a while, and now I'll definitely try :-)
any idea on how can i connect this one to database? Now, I have users table with username and password field in my users table. how do i connect this to the login system?
I've found http://www.rorapi.com/ by far the cleanest Rails search engine. It uses Google Co-op and indexes the Core Ruby, RoR, Prototype, and Scriptaculous APIs.
To sweeten the deal there is a Firefox search plug-in!
@macovsky, I haven't done it yet. I made one attempt but wasn't satisfied so I didn't publish it. Still planning to talk more about this in the future.
Great screencast as usual. I have learned so much from your podcasts that my rails abilities have improved considerably.
Unfortunately, the will_paginate plugin won't work with my version of rails (1.2.3). I'm not able to start mongrel, as I get "finder.rb:11:in `included': undefined method `alias_method_chain'". Shame as I really want to use it for an artists website that I'm redesigning.
Thanks again, Ryan. You are the man.
thanks for pointing the way to will_paginate. however, i was trying to implement it to paginate "entries" that works with the "acts_as_taggable" plugin. i placed this in the entry model.
def self.taggedwith(tag, page)
paginate :conditions => ["tags.name=?",tag],
:joins => "INNER JOIN taggings ON entries.id = taggings.taggable_id INNER JOIN tags ON taggings.tag_id = tags.id",
:order=>"entries.created_at DESC",
:per_page => 10,
:page => page
end
while i do get the correct entries, the tag_list are always incorrect. could you suggest any workaround?
I like how you showed the process of refactoring in this series, but I wouldn't recommend multiple assertions in one controller.
See http://blog.jayfields.com/2007/06/testing-one-assertion-per-test.html
@lisa, with UJS it'd extremely simple to layer ajax pagination on top of will_paginate. Check out ujs4rails.com :)
That good ep. I wish you create episode about testing on rails. Thaink you
Hi, I'm the main maintainer for the will_paginate plugin. Ryan, thanks a lot for this screencast! For the rest of you, you can get familiar with the plugin by generating the RDoc documentation; simply type "rake rdoc" while in the plugin directory.
If you want to report bugs or suggest features for this plugin, go to http://err.lighthouseapp.com/projects/466-plugins. Thanks!
Is it wrong that I was giddy like a small child on Christmas day when I saw the new Railscast in my iTunes Podcasts directory? Thanks for all your awesome work on these podcasts!
I found an Ajax approach here that lets you "sort, search and paginate"
http://dev.nozav.org/ajaxtable/?sort=name
I could also write a helper for AJAX paginating links for paginating_find...
Wouldn't mind seeing how these two plugins stack up with each other.
Lisa - it's pretty easy to write a helper to do your AJAX pagination. There's a good example in the (awesome) exception_logger plugin. It's designed for classic pagination, but something like this would work for will_paginate, too. Check it out: http://svn.techno-weenie.net/projects/plugins/exception_logger/lib/logged_exceptions_helper.rb
"kinda" rails related, but a short screencast of how you do your shortcut magic in textmate might be cool.
@Joe, good question. If you want the user submitted date to stick around for an invalid entry you should store it in an instance variable in the setter method. Then read from that instance variable in the getter method if it's set. You can see the code here:
http://pastie.caboo.se/74917
@lisa, nope, AFAIK will_paginate doesn't offer anything special in regards to AJAX. You can still use the back end part of the plugin to manage the pagination, however, you may need to rewrite the view portion to use link_to_remote instead of normal links.
Does will_paginate do AJAX pagination? Paginating_find does not (currently) and if will_paginate can do this I may migrate to it.
Ryan, When entering an invalid date and the form is redisplayed with the error, the invalid date string is lost and replaced with the old date value. What would be the best way to keep the text value that the user entered so they can more easily see and correct their mistake?
@riki, not exactly sure what you're referring to. You can pass an ":order" option just like the "find" method so you can do any sorting you wish.
@dave, I haven't used paginating_find but it looks pretty good.
I've been using paginate_find and it works pretty well. Have any opinions/experience with that plugin?
The paginate in the model ability from will_paginate looks really cool.
Aaah very cool. How could we combine this with a List sort function?
Using Rails Edge almoust month. It really rocks :).
Thats good railscast too. Just thought that i should search something about pagination tomorrow.
+1, great cast!
ф пятерке!
neat!~
Definitely a good choice for pagination .... Great tutorial as usual!
@Onu, thanks, it's fixed now. :)
For perfection:
Contest image tag should end with />.
Somewhy hidden input fails too in validator. Maybe someone can explaink, why hidden input needs to be in div or p tag too?
Hey.
Congratulations.
I would recommend to do some railscasts about caching.
Congratulations on number 50, Ryan!
Next time I stumble upon some missing documentation, I will commit a patch, now that I know how easy it is.
Thanks a lot for demystifying this topic!
Hi,
I have posted it on:
* Index
* » Rails Programming
* » Super Simple Authentication
Thanks
script/console isn't being "flaky" -- I believe the reason why your "name" method on your project didn't autocomplete until you accessed it because the method is created in the class by ActiveRecord::Base when it notices it doesn't exist (through a call to method_missing) See ActiveRecord::Base define_read_methods.
@bradc, good question. There's no way to override the default :order by passing the options. To change this behavior you need to reverse it so the :order statement is in with_scope and the options are passed directly to the find method.
If I specify an :order option when calling find_incomplete, will with_scope override the one that's already defined by default?
A great topic for the 50th cast :)
Thanks for all your hard work here and on railsforum Ryan, I'm sure your posts sped up my (and many others') process of learning rails!
@Jack, for information on doc patches the best place to go is railsdocumentation.org. There's not much activity yet because it just started, but there's some very knowledgeable people there. I recommend asking your question on their google group.
Also, doc patches don't need to be elaborate, simple grammar/spelling fixes are fine.
I have a link to this screencast in http://thinkingeek.com/index.php?/archives/17-Customizing-IRB.html because I think it's a great one! :)
I was wondering if there was a place were people could request improvements. (sort of like how Wikipedia pages might have a "The needs further documentation" type message at the top) If not are there any other suggestions for newer people (like myself) as to where to start for needed doc patches?
Thanks and Congrats Ryan on the success of Railscast.
The "yield" call in a layout will output the contents of the template. When supplying a parameter (:head in this case) it will output the contents of that content_for block. I explained this in the episode, sorry if it wasn't clear.
@Brian, I recommend asking your questions over at railsforum.com. That way it will be easier to post code samples and ask more detailed questions. I visit there frequently so hopefully I can get around to answering you there. Thanks.
Great screencast Ryan. As a learner to rails I have found your screencasts to be really helpful. Keep up the great work.
A big bravo for this great 50th episod! Many thanks Ryan, what you are doing is just amazing! :)
Ryan, you are to be highly commended for your work to help the Rails community. Your screencasts are simple and clear and very to the point.
The first thing I tell people who ask me for help on rails is "Go and download EVERY railscast and watch them all... then come back to me :)
Well, actually... I tend to help them first... but that is the second thing I tell them!
I download your railscast as soon as it comes out and am never disappointed.
I have also followed your example and submitted my first patch!
http://dev.rubyonrails.org/ticket/8770
Thanks again Ryan! You officially rock (or should we say "roll" as this is ruby on RAILS :)
Regards
Mikel
Awesome screencast - Ryan you absolutely rock! Doing this live, seeing how easy it was (give or take a few prerequisites), made my day... I've been thinking about fixing all the typos in the docs for a while, and now I'll definitely try :-)
This episode rocks!
You are one of the extremely rare breed that can sit down, record a screencast, say "oooh" and "aaaah" a lot of times and *still* be cool xD
Kudos :D
now it can be downloaded ^_^
hi,
what is the meaning of yield and :head in => <%= yield :head %>
Ok, Ryan, will be waiting patiently :).
Media.railscasts.com does not seems to work? Its answer on pings, put not on port 80?!?
Hi to all!,
any idea on how can i connect this one to database? Now, I have users table with username and password field in my users table. how do i connect this to the login system?
Thanks
I've found http://www.rorapi.com/ by far the cleanest Rails search engine. It uses Google Co-op and indexes the Core Ruby, RoR, Prototype, and Scriptaculous APIs.
To sweeten the deal there is a Firefox search plug-in!
@Mahmoud, the author just forgot to prefix their site with "http://". I fixed it so it works now.
@ream88, sorry about no markup. On my long list of stuff to do...
@macovsky, I haven't done it yet. I made one attempt but wasn't satisfied so I didn't publish it. Still planning to talk more about this in the future.
@Warren, there's a plugin out there which allows you to use subdomains in route conditions.
http://weblog.rubyonrails.org/2006/5/22/dan-webbs-request-routing-plugin
I'm not sure if it's fully compatible with Rails 1.2.3, but it might get you partway there.
I think it's best to keep this all in one app. That way it's easier to share the tables, logic, and mongrel instances.