RailsCasts Pro episodes are now free!
Learn more or hide this
Yay for mondays and railscasts! Love your work! Thanks alot!
Yes! I was actually looking for a form creator like this yesterday... Can't wait for next week. =)
Nice one, really handy and I am eager to hear and see more soon ^^
Garfield was born in the kitchen of Mama Leoni's Italian Restaurant (June 19, 1978) and immediately ate all the pasta and lasagna in sight ^^
A coffee and your cast that I'm calling a good Monday. ;) Thanks
hehe same for me, coffee+railscast=good start of the week
thx ryan :)
@Samuel that's true. Again a great screencast!
I've been using formtastic for a while now and it's really awesome!
Thanks for this screencast, Ryan!
Really great cast, thx again Ryan!
Ryan, I really don't think I could've asked for a better introduction to Formtastic. I watched it with a huge smile. Looking forward to part 2!
It requires XHTML? That's crazy! XHTML must be served as text/html to get acceptable browser support, and then it renders worse than HTML4.
Ryan, as usual, you are making our mondays very much interesting! thanks for another great cast!
Very interesting! Makes our work even faster huh? Looking forward for part II.
Ryan, you could make a list of your favorite plugins/gems you use. What you think? We now have a lot of options to use with our Rails projects and is getting harder to make a choice. Thanks.
Great episode! Just a small remark: Wouldn't it better to use gemcutter.org as gem source? The newest version of Formtastic is v0.2.5 which is not (and never will be) available on gems.github.com.
For another approach to forms, check out my Informant gem:
@Justin, glad you like it! Keep up the great work with Formtastic.
@Joachim, you're right, the gemcutter source would be better. I actually recorded this episode a few weeks ago, and I'm not sure if that was available at the time.
Neato! You could use category:references when generating the animal model, which would add the belongs_to call automatically.
Great episode like always! I was really impressed by how easy the customization is. And thanks for the laugh: "Cuddly, but Deadly", hehe, straight to the point :)
Nice episode on forms. Thanks Ryan! thanks Justin for this plugin. It's really handy
Thank you!!! I've been hoping to see this one. Great job! Keep up the awesome work
I hang out monday afternoons (aus time) waiting for your rails casts and it is never a dissapointment... awesome work on this one... i can't wait to use it for our projects.
If not covered in part two, maybe a part three covering the usage of Searchlogic and Formtastic in tandem?
Thanks for the work.
Cute but perhaps a bit gratuitous. I prefer to use form builders wrapped in a helper method. Cheers.
I know it is not good to ask this question here, but I can't stop myself from doing this coz I need this function immediately.
Does anyone know how to send formatted output to printer using Ruby?
Is there a way to send a formatted pdf document to a printer using Ruby?
I need suggestions. Please help.
Ryan Bates rocks....
Post your question on www.stackoverflow.com. You'll probably get an answer more quickly than here :)
I was thinking about something very much like this last night. The difference is that I was thinking of something that would loop through all existing models in a project and generate the forms. This looks great on its own, but also looks like a fantastic starting point for a generate-new-forms plugin!
Great comparison between traditional scaffold and formtastic.
I would like to see how validation works in formtastic.
Great job as usual. Please make sure to cover Formtastic in at least 3 or 4 episodes. It is that good.
Validation error messages is attached to the fields instead all in one huge block, and you can render general form errors using errors[:base] - pure Rails.
FYI: I'm a heavy Formtastic user and created a gem that handles client-side (and fallback on AJAX when client-side not possible) validations of forms by extracting needed validation info from your models. Formtastic markup in mind, so it's compatible out of the box. Actually compatible with any markup if you want. Check it out:
Unobtrusive and JS framework agnostic. =)
I just tried out the formtastic textmate bundle, and notice that the ftgem snippet still generates a source option for the gem as github.
I sent a message to the author of the bundle via git about that. If there's time, you might want to mention this in the next railscast.
Gemcutter is now default. =)
How to apply the same admin side, Unable to do nifty scaffolding on admin side. ruby script/generate nifty_scaffold 'admin/authors'???
After install in a fresh rails structure and then running
gem sources -a http://gemcutter.org/
gem install formtastic
I get this error after editing my form:
undefined method `semantic_form_for' for #<ActionView::Base:0x64bf054>
The formtastic.css shows up ok and I modified the layout to include this. I've tried it with standard and nifty scaffolds. Any ideas for the error? I'm thinking it is something with the gem and my configuration. But I'm new to rails and clueless.
I think a minor correction in the code snippets is needed.
The comment for the first form should be:
<!-- views/categories/_form.html.erb -->
It is showing as views/animals/... for both form snippets.
Same as Dave
After installing formtastic and altering forms:
undefined method `semantic_form_for' for #<ActionView::Base:0x64bf054>
Looks like you've had a herd of trained monkeys who've managed to post nearly 50 link spam comments to your site. Must be human to get through the Captcha.
Can you help me with this error :
uninitialized constant Formtastic::SemanticFormBuilder::I18n
Extracted source (around line #6):
3: <%= error_messages_for :task %>
5: <% semantic_form_for(@task) do |f| %>
6: <%=f.inputs %>
7: <%=f.buttons %>
8: <% end %>
Don't use justinfrench-formtastic, that's too old. Use formtastic from gemcutter.
The usual reasons for "undefined method `semantic_form_for'" are:
* you haven't added the gem to your environment.rb
* you forgot to restart your server after addding the gem to the environment (or installing the plugin)
* you have config.plugins set in your environment to load plugins in a specific order, but it doesn't include formtastic
Just wanted to say: thanks for all the superb tutorials! Keep up the good work!
Formtastic Tutorial! :-) really excelent, I did it without any trouble.
Which is amazing because I'm totally new with Rails.
I have a question:
in the animal view, this http://0.0.0.0:3000/animals/1 for example, how can I change the category view to show the category's name and not its number? Thanks in advance
Ok, another question, I know is not related directly with formtastic, sorry in advance, -I'm just learning Rails-
How can I modify the animal show to show the problems and symtoms?
Sorry again. I already figure it out how to show the symptoms.
What happen is that is a fact that Rails take away every difficulty of your path to make things works.
Next time I'll work a little more before ask for an advice.
Thank you, very nice. However, some files can not be displayed on your website, be aware of.
Hi Ryan -
I notice that your born_on date field displays the current date by default in your app while using formtastic. My app doesnt do that.... I've added:
@flightdate ||= Date.today
to my model...but, I can't get my f.input :flightdate to display today by default...its just blank.
What can I do to make the formtastic date fields display today by default? Why did your app work as expected?
Thank you for all that you do! Your screencasts are invaluable. And, thanks to Justin too for creating formtastic...it is awesome.
As soon as I posted (#75) I realized the answer...at least one way of doing it. All I did to get the formtastic date field to default to today was to specify it in the new action. In my app it looks like this:
@flight = Flight.new( :flightdate => Date.today )
WARNING. As of Rails 3.1, one NEED to use = in front of semantic_form_for AND f.inputs, otherwise the tags won't be outputted. Took me some time to understand why my formtastic forms weren't working anymore!
I want to know how to post image