Look out Ryan Bates - There's a New Screencast in Town
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!