lml / sketchily

Embed SVG-edit in Rails HTML forms
MIT License
26 stars 9 forks source link

Error applying a sketchily option #11

Closed sarupbanskota closed 10 years ago

sarupbanskota commented 10 years ago

When I do a:

  = form_tag edit_svg_project_path do
    = sketchily_tag :sketch, :hide_menu => true
    = submit_tag

I get the following error: http://pastie.org/8437549

Dantemss commented 10 years ago

Sketchily tag works like other form_tag methods and requires you to specify an initial value (before the options):

sketchily_tag(name, value = nil, options = {})

So what you want to use is something like this:

= sketchily_tag :sketch, @object.sketch, :hide_menu => true

If you would like to automatically get this value from the model, you want to use something like form_for:

= form_for @object do |f| = f.sketchily :sketch, :hide_menu => true = submit_tag

sarupbanskota commented 10 years ago

Gotcha! Thanks ;)

Further, I'm using sketchily in https://github.com/EmilyDirsh/GlitterGallery, so if you'd like people to look at example usages, you could link to it. Thanks again!