April, 2010

I don’t get form_tag

Tuesday, April 20th, 2010

Ok, so I call something like

html_options = {
  :onSubmit => "new Ajax.Request(\\\"/barn/render_event_response\\\")"
}
 
form_tag("barn", html_options)

Can you see my well-escaped JavaScript?

However, I get

"<form action=\"/barn/render_event_response\" method=\"post\" 
  onsubmit=\"new Ajax.Request(\\&quot;/barn/render_event_response\\&quot;)\"

Why does Rails &quot; my JavaScript? Can anybody help?

Releasing with Jeweler

Saturday, April 17th, 2010

I love jeweler for releasing my gems, however I tend to forget how it is working, so here’s my release workflow.

1. Bump and Commit

Bump the version (usually in lib/a_perfect_gem/version.rb) and git commit my latest changes

2. Doublecheck

git status to check if my working tree is clean

git status
# On branch master
nothing to commit (working directory clean)

Otherwise jeweler will complain

$ rake release
rake aborted!
Hey buddy, try committing them files first

3. Release

Finally do

$ rake release

which will

  • tag the commit with "v#{A_PERFECT_GEM::VERSION}"
  • push the commit(s) to origin
  • push the tag to origin
  • build the gem
  • push the gem to gemcutter

Props to [technicalpickles].