Look out Ryan Bates - There's a New Screencast in Town 18

Posted by james
on Sunday, January 27

So, I'm sitting there on Friday evening working on a screencast introduction to attribute_fu, when Fabio Akita sends me an email to tell me he just created one for resource_controller! It was like he'd read my mind.

Fabio was nice enough to agree to let me put some title screens on his r_c screencast, but I couldn't seem to get it to export while still looking decent. So, here's the first episode of GiraffeCasts (for those of you who don't know, my company is called GiraffeSoft), and Fabio's awesome resource_controller introduction.

Episode 1: attribute_fu

Episode one is a quick walk through the basics of attribute_fu. Get it here.

As promised, here is the code from the screencast:

## _task.html.erb
<p class="task">
  <b>Title:</b><br/>
  <%= f.text_field :title %>
  <%= f.remove_link('Remove') %>
</p>
## _form.html.erb
<div id="tasks">
  <%= f.render_associated_form(@project.tasks, :new => 3) %>
</div>
<%= f.add_associated_link('Add Task', @project.tasks.build) %>
class Project < ActiveRecord::Base
  has_many :tasks, :attributes => true
  
  private
    before_save :remove_blank_tasks
    def remove_blank_tasks
      tasks.delete tasks.select { |task| task.title.blank? }
    end
end

To get attribute_fu:

$ piston import http://svn.jamesgolick.com/attribute_fu/tags/stable vendor/plugins/attribute_fu

Fabio's resource_controller Screencast

Fabio Akita gives an excellent tour of resource_controller, in screencast form. Get it here.

See Ya Next Time

That's all for today. Check back for more GiraffeCasts!

Comments

Leave a response

  1. AkitaOnRailsJanuary 27, 2008 @ 10:12 PM

    Great work James, both plugins are amazing. I hope both screencasts help people realize how useful they can be.

  2. DonJanuary 28, 2008 @ 12:56 AM

    Nice job, quality screencasts are always welcome and helpful. From a fresh pair of eyes and ears, I think it moves a little quick. Sometimes code is being discussed at the same time it's written.

    I know it's hard to gauge presentation speed when you've gone over the material a dozen times yourself, and it's just my observation; "too fast" will obviously vary from person to person. I can just rewind if I'm too slow! :)

  3. rubylicio.usJanuary 28, 2008 @ 04:58 AM

    the link "resource_controller" is wrong. Nice first screencast :)

  4. James GolickJanuary 28, 2008 @ 09:03 AM

    Thanks for the comments guys - I appreciate the feedback. I'll definitely try to slow the next one down a little.

    Also, the link is fixed :)

  5. ClovisJanuary 28, 2008 @ 11:05 AM

    Very nice scast, Keep on the good work, Watch out Ryan bates!!!

  6. macournoyerJanuary 28, 2008 @ 12:42 PM

    omg! nice job James & Akita. You should put this on a dedicated site like Railscast, would be a hit.

  7. Carl MercierJanuary 29, 2008 @ 05:58 PM

    You need some sort of feed for those, I want iTunes to auto-download them :)

  8. pimpmasterFebruary 05, 2008 @ 08:53 PM

    Nice screencast and plugz!

    I do have a couple o questions

    1. Does attribute_fu work with polymorphic children?

    2. In case it doesn't, lets say I want to have multiple belongs_to and have that task partial sitting in a shared directory. How would I override the default behavior?

  9. pimpmasterFebruary 06, 2008 @ 08:03 AM

    I figured out #2.. using :partial as argument in addassociatedlink()

    Also realized there is no polymorphs yet.. wonder how hard it would be to implement

    hmmm..

  10. James GolickFebruary 06, 2008 @ 08:44 AM

    I'm not sure what you mean about supporting polymorphic children.

    It definitely supports has_many :as - or do you mean something else?

  11. pimpmasterFebruary 06, 2008 @ 01:18 PM

    Ahh, you are right.. it does support!

    The only thing that bugs me about this implementation is the repetitive before_save method that has to be pasted into every model.

  12. James GolickFebruary 06, 2008 @ 02:23 PM

    Yeah, you could create a module, and just include it in various models.

    Also, there will likely be some wrapping of that functionality in the next release.

  13. MalkoFebruary 11, 2008 @ 02:46 PM

    James,

    Can this be used to create multiple items of one model. Let's say a form to create multiple Projects instead of multiple tasks per project?

  14. James GolickFebruary 11, 2008 @ 04:00 PM

    Malko - No, the plugin doesn't do that, sorry.

  15. Gianluca TessaroloFebruary 14, 2008 @ 11:44 AM

    Congratulations: very impressive screencast !!!

  16. gdlApril 06, 2008 @ 01:11 PM

    attributes_fu hat similar problem like http://railsforum.com/viewtopic.php?id=803

    def update ... respond_to do |format| params[:project][:tast_attributes] ||= {} if @project.update_attributes(params[:project]) ... end

  17. Bryan donovanApril 20, 2008 @ 06:55 PM

    James, this is extremely cool, thanks! I love resource_controller as well.. good stuff.

  18. FrankJune 07, 2008 @ 08:41 AM

    A very good screencast, but you are moving along a tad too fast for my taste. I'm used to Ryan Bates' style since I've watched quite a few of his screencasts lately, and I think he found the perfect pace -- so that would be my frame of reference here.

    Other than that, great stuff. Pleasant voice to listen to, no mumbling and good video quality.

Comment






Clicky Web Analytics