Rails Gracefully Degrading Javascript link_to for post / non-get methods

This works at least on Rails r8440. Just stick the code somewhere it gets loaded – I put it in vendor/plugins/graceful_link_to/init.rb

# graceful_link_to
# Jason Ling
# http://jason.lah.cc
# This hacks link_to to produce an alternative button_to that shows for users without javascript
# You need to include the prototype libraries and put at the bottom of your pages the following javascript
# javascript_tag "$$('.js_hide').invoke('hide'); $$('.js_show').invoke('show');"
ActionView::Helpers::UrlHelper.class_eval do
  def link_to_with_graceful(name, options = {}, html_options = {})
    return link_to_without_graceful(name, options, html_options) if !html_options[:method] || html_options[:method] == :get
    %Q(<div class="js_hide">#{button_to(name, options, html_options)}</div><span style="display: none;" class="js_show">#{link_to_without_graceful(name, options, html_options)}</span>)
  alias_method_chain :link_to, :graceful
This entry was posted in Rails. Bookmark the permalink.

38 Responses to Rails Gracefully Degrading Javascript link_to for post / non-get methods

  1. I’m very interested in your article, and I suggest you to browse some online stores to find something different. Such as: nike shoes air jordansand discount louis vuitton bags,cheap chi flat iron,vibram five fingers shoes. I believe you would like thecheap ghd hair straighteners,nfl team jerseys. What’s more, the
    chi flat iron,
    cheap ed hardy clothing,
    ugg store,
    mens rolex watches t shirt would give you an unifque life.

  2. puckshow201006

    louis vuitton handbags louis vuitton handbags
    louis vuitton bags louis vuitton handbags
    louis vuitton louis vuitton handbags
    louis vuitton bag louis vuitton handbags
    louis vuitton wallets louis vuitton wallets
    louis vuitton purses louis vuitton wallets
    louis vuitton wallets louis vuitton wallets
    discount louis vuitton handbags on sale
    fashion replica louis vuitton on sale
    looking for louis vuitton purses on sale
    go to buy louis vuitton handbags
    many louis vuitton handbags on sale
    I want to buy louis vuitton wallets on sale
    looking for louis vuitton purses for sale

    louis vuittonreplica louis vuitton
    louis vuitton 2010replica louis vuitton
    replica louis vuittonreplica louis vuitton
    replica lvreplica louis vuitton

    louis vuittonReplica louis vuitton handbag
    replica louis vuittonReplica louis vuitton handbag
    louis vuitton pursesReplica louis vuitton handbag
    louis vuitton walletsReplica louis vuitton handbag

    Mens WatchesReplica louis vuitton Purses on sale
    Hamilton WatchesReplica louis vuitton Purses on sale
    Cheap WatchesReplica louis vuitton Purses on sale
    Cheap Watches for saleReplica louis vuitton Purses on sale

    Christian LouboutinDiscount Christian Louboutin
    Christian Louboutin shoesDiscount Christian Louboutin
    Christian Louboutin bootsDiscount Christian Louboutin

    miu miumiu miu handbag
    miumiumiu miu handbag
    miu miu handbagmiu miu handbag
    miu miu bagmiu miu handbag

    miu miuMIU MIU handbags
    miuMIU MIU handbags
    miu miu bagMIU MIU handbags
    miu miu bagsMIU MIU handbags
    miu miu handbagMIU MIU handbags

    guccireplica gucci
    replica guccireplica gucci
    gucci handbagsreplica gucci
    gucci shoesreplica gucci
    wholesale guccireplica gucci

    ladies WatchesFree worldwide shipping
    men’s WatchesReplica watches for sale
    buy Watchespiaget watches for ladies
    Watches for saleLadies watches and men’s watches

    China wholesaleyou will find what you need
    wholesalethere are many for wholesale

  3. Thank you for sharing, i believe your readers’ will become much more.
    by Discount desigenr handbags

  4. Hochfart says:

    The Apple MacBook Pro MC737LL belongs to one of the most powerful series of the Apple laptops.prom dresses Laptops in this series are known for their ability to multitask and handle rather complex programs and tasks that may seem to be a mountain for laptops of less power. bridesmaid dressBut what are some of the features of this particular laptop that make it to be such a jewel?hair extensions

    First, the computer is powered by a 2.66 GHz i7 Core processor. Coupled with a 4 GB DDR 3 RAM, this feature enables the computer to handle a lot of tasks at the same time while ensuring that it minimizes on the power consumption. cheap wedding invitationsConsidering that the machine will be powered by a battery when it is not plugged to the socket, this energy efficiency feature is one of its most prized features.dress up games for girls The laptop battery life is estimated to be around 9 hours of work after a single charge.wedding hairstyles

    When it comes to the storage space, the laptop is equipped with a 500 GB hard disk capacity, which gives you the ability to store plenty of music, movies, and other forms of data in your laptop. hairstylesTo enable you to store your information, the machine is also equipped with an 8 x DVD/CD superdrive.front lace wigs

  5. Great article gents, wholesale high quality shoes very in depth and a Cheap Women’s Brand Clothinggood balance to the “Everyone is over-rating Scott Richmond” post. Richmond’s win-loss record wholesale men shoesreally doesn’t tell a clear story about how well he has pitched thus far in the majors and minors. I think cheap jerseysI appreciate him even more now.

  6. HOHO says:

    You would be stunned be listening to this louis vuitton fact that louis vuitton bags introduces the latest styles of louis vuitton handbags on sale Louis vuitton handbags in the vuitton worldwide market in a most lv handbags professional and discount louis vuitton bags scintillating manner. One of the louis vuitton bag prices most fascinating designer purses news for you my dears Louis Vuitton Scarves is that Louis Vuitton Shoes louis vuitton handbags come in newest styles, designs, sizes, colors, and shapes in the global market these days. From Sunrise Orange to Cosmic PM Rose, from Solar PM Taupe to White To Brown Shades Flap, and Louis Vuitton Caps from Alexa Blue to louis vuitton ties White Shopping Tote Safiano, we bring each quality louis vuitton earrings design of burberry replica handbags in the international omega watches market so as to fulfill your modern day needs omega and louis vuitton handbags desires in style.
    Another most important gucci handbags thing is that Christian Louboutin makes use of louis vuitton latest tools and louis vuitton shoes technologies in order to create your vuittonlouis vuitton handbags designs in a most artful andgucci bags professional manner. louis vuitton luggage That is why louis vuitton bags they are very elegant and louis vuitton graceful piece of equipments in the global louis vuitton handbags market in most recent times. Whoever sees our louis vuitton bags replica handbags online, he or she becomes immediately fond of louis vuitton bags it. That louis vuitton wallets in why most of Hollywood as well as Bollywood female actors have become fond of these louis vuitton shoes elegant and burett watches graceful online Louis vuitton handbags today.
    Next most fascinating news is that louis vuitton bags offers discounted kenneth cole rado louis vuitton replica handbags service to its valued customers worldwide for a very limited period of time. So kenneth guide wherever you are my dears, longines dkny you should immediately contact with longines guide so as to get the best longines information louis vuitton replica handbags in a most louis bags economical and affordable louis vuitton news manner. As a result, you would be surely able to fulfill your modern luxury women contemporary needs with miumiu news elegance and nba 2011 grace. Another interesting announcement is that nba information we offer customized watches guide louis vuitton replica handbags to our customers worldwide in a watches luxury thoroughly professional and 2010 movie dedicated manner.
    Last but not least, iphone information brings some of the most glamorous, and hot, as well as sexy designs of watch 2010 louis vuitton replica handbags in the international market today. Interestingly all of these garden suggest online replica handbags would fit to the styles of glamorous ladies in a most scintillating manner. That is why they cannot only enhance their beauty shoes blog on the dot but also increase their confidence immensely. Whoever sees these sexiest and stylish women in louis vuitton replica handbags, he or she must get attracted towards them immediately. In short, http://www.replicapot.com meets up the individuals demands by offering them the latest quality designs of louis vuitton replica handbags worldwide in a most economical manner.

  7. Free world of hermes replica warcraft leveling guidesYou omega replica can find a handful of good warcraft designer watches guides on the market which will Tag Heuer replica anyone can use to play with the overall Glashutte replica game, improve their figures Experience deWitt replica points level fairly quickly, and in many chopard watches cases take place gone utilizing replica watches personalised items, supports breguet watches , periods, items, and better. designer handbags There is internet bally replica handbags websites improvement put into dolce & gabbana handbags typically the world of warcraft bottega veneta replica handbags described as “The Using Crusade” together Mulberry handbags with takes place during the road locale Marni handbags labeled “Outlands” consequently make replica handbags certain that any kind of whoa leveling show you match loewe handbags carries recommended changesupdates to help cheap burberry handbags you levels via 60 thru seventy plus realize amazing warcraft fame and replica chanel handbags fortune as well as the desirable taking attach.

  8. Everybody know mbt barabara black for Masai Barefoot Technology.The company that makes mbt maliza brown is Swiss Masai.This mbt chapa navy creates a natural, uneven walking surface and forces the body to use all the major and stabilsing muscle groups, thus training the whole body to move correctly.

  9. mbt barabara shoes suit for the person who like running over walking, so covering the distances required in crowds is frustrating and uncomfortable, and standing for long periods is absolutely painful. Whether the mbt maliza black, for health, I think the mbt shoes may be overlooked mbt shadow shoes still despite what I’d consider to be tangible benefits.

  10. as says:

    top designers Gucci Handbags or louis vuittonWallets Shopping is
    Gucci Handbags or at SmarterGucci handbags top designers

  11. The web Discount Windows Product Key has cheap Windows Key changed wholesale Office Product KeyAnd DiscountWindows Activation there’s a cheap wholesale Windows Activation Key new way wholesale DiscountOffice Activation Key of Discount thinking cheapWindows Generator about wholesaleWindows Key Generator your DiscountOffice Key Generator applications.cheapWindows Keygen You wholesaleWindows Key can’t DiscountOffice Keygen</ajust write cheapWindows Upgradesome wholesaleOffice UpgradeHTML and DiscountMicrosoft UpgradesCSS cheapWindows 7 Product Keyanymore wholesaleWindows 7 Key 2009and DiscountWindows 7 Keyexpect cheapWindows 7 Ultimate Keyto be wholesaleWindows 7 Home Premium Keythe next DiscountWindows 7 Professional Key Twitter. Hear cheapWindows 7 Product Keyhow to wholesaleMicrosoft Office 2010 Product Keymake your site wholesaleMicrosoft Office 2007 Product Keysocially

  12. Wanling says:

    TheCartier Classic Santos Series Replica Watches
    Black Roman numerals, Blue hands, Displays date at 3.Silver dial with Large Black Roman numerals, Black sword shaped hands, Crown set with sapphire.
    Cartier New Santos Series Replica Watches Stainless steel case & Bracelet, Silver dial with Large Black Roman numerals. Luminous hands, Crown set with blue sapphire. Replica Cartier Baignoire Replica Watches.Solid 18KT White gold case, Black satin strap, Diamond set bezel Silver dial with Black Roman numerals, Blue hands, Crown set with a diamond. Replica Cartier Baignoire Replica WatchesIntergrated Black Rubber & Stainless Steel Strap, Folding Buckle, Magnified Date at 4, Luminous Hands & Hour Markers, Roman Numerals Engraved into satin finished bezel.

  13. NFLjerseys says:

    If NFL jerseys and football jerseys are your favorite, nfljerseys-shopping.com can be your good choice as it supply many cheap jerseys.

  14. bvlgari watch says:

    All Famous Brand Watch products are covered by the original manufacturer popular brand watch.brand Watches Gucci watch,Tag Heuer Watches swiss movement watch,Breitling Watches longines watch,Invicta Watches movado watch,TechnoMarine Watches breitling watch,Seiko Watches Tissot,Men watch & women watch cartier watch,and so on as everyone knows gents watch.A watch is a timepiece that is made to be worn on a person V.Constantin watch.It is usually a wristwatch quartz analogue watch,worn on the wrist with a strap or bracelet woman watch.In addition to the time tudor watch,modern watches often display the day steel brand watch,date timex watch,month and year piaget watch,and electronic watches may have many other functions vintage watch,depending on how modern the watch is CK watch.

  15. Cowboys shop says:

    Cowboys shop
    Cowboys Jersey
    Miles Austin Jersey
    Marion Barber Jersey
    Tony Romo Jerseys
    Dez Bryant Jersey
    Saints Jerseys
    Reggie Bush Jerseys
    Drew Brees Jerseys
    Garrett Hartley Jerseys
    Scott Fujita Jerseys
    Adam Jones Jersey
    Jets Jerseys
    Mark Sanchez Jersey
    LaDainian Tomlinson Jersey
    Jeremy Shockey Jerseys
    Bill Bates Jersey
    DeMarcus Ware Jersey
    Emmitt Smith Jersey
    Felix Jones Jersey
    Jason Witten Jersey
    Roger Staubach Jersey
    Roy L. Williams Jersey
    Roy Williams Jerseys
    Tashard Choice Jersey
    Terence Newman Jersey
    Tony Dorsett Jersey
    Troy Aikman Jersey
    Cowboys Men’s Jersey
    Cowboys Replica Jersey
    Cowboys Premier Jersey
    Cowboys Authentic Jerseys
    Cowboys Personalized Jersey
    Cowboys Women’s Jersey
    Cowboys Kids Jersey
    Cowboys Hat
    Saint Shop
    Saint Super Bowl Jerseys
    Archie Manning Jerseys
    Marques Colston Jerseys
    Lance Moore Jerseys
    Sedrick Ellis Jerseys
    Robert Meachem Jerseys
    Devery Henderson Jerseys
    Jonathan Vilma Jerseys
    Mike Bell Jerseys
    Tracy Porter Jerseys
    Deuce McAllister Jerseys
    Pierre Thomas Jerseys
    Malcolm Jenkins Jerseys
    Patrick Robinson Jerseys
    Darren Sharper Jerseys
    Saints Men’s Jerseys
    Saints Replica Jerseys
    Saints Premier Jerseys
    Saints Authentic Jerseys
    Saints Personalized Jerseys
    Saints Women’s Jerseys
    Saints Kid’s Jerseys
    Saints Hats
    Discount NFL Jerseys
    NFL Jerseys on sale
    Minnesota Vikings Jerseys
    Dallas Cowboys Jerseys
    Houston Texans Jerseys
    Pittsburgh Steelers Jerseys
    Indianapolis Colts Jerseys
    New Orleans Saints Jerseys
    Air Jordans shoes 2010
    Air jordans 2010 price
    Air jordans 2010 for sale
    Nike Air Jordans 2010
    New Air Jordans 2010
    Release dates for Air jordans 2010
    Valentine Air Jordans 2010
    Valentines day Air jordans 2010
    New arrivals jordans
    new arrivals retro jordans
    new arrivals jordans for sale
    buy new arrivals jordans
    cheap new arrivals jordans

  16. uggbailey button chestnut,in the high-fashion footwear with funky and ugly appearanceugg krinkle,bailey button ugg boots uk,chestnut bailey button ugg boots,uggs classic short sand,What’s in these boots, the charms of many girls ofwomen’s bailey buttonbailey button krinkle,bailey button chestnutugg bailey button,raspberry rose ugg boots,uggs short sand,all ages and types? Well, these boots come with two important aspects that girls love to doIf you want tougg classic tall boot pewter equivalent ugg classic tall sunflowera undefeated web ugg classic tall chestnut,designer, you exigency go into,usable, functionalugg classic tall black,,interface designs at the ugg classic tall chocolate,crux of your work. , ugg classic tall bomber boot This will contribute ,to the fleshingugg classic tall grey , out of ,not humle , ,ugg classic tall navy, your convoy ugg classic short sand,(or whatever vigor you design for),ugg classic short chestnut,,but moreoverugg classic short ultramarine,mini ugg boots, ugg classic short spiced coral ,besides,ugg classic short chocolate, furthermore,ugg classic short sale, further yourself.ugg classic short fancy,A popularugg classic short metallic, interconfront designugg classic cardy boots grey,is crucialugg classic cardy grey ,you can takeugg classic cardy black,pride in ugg classic cardy oatmeal,and leave getugg classic cardy boots black,you futureugg classic cardy fig,contracts.ugg classic cardy tall ,Clickable ugg classic cardy sale,Wireframes, ugg bailey button triplet,Usability ugg bailey boots, Testing andugg bailey button bomber,Digital Paper ugg bailey button side boots,Prototyping.ugg bailey button uk, Fast wireframeugg bailey button bomber boots,creation andugg bailey button grey,remote website ugg bailey button sale,usability testing lead to anugg bailey button boots,larger conversion!

  17. shop-timberland.com is a excellent Timberland Online Store introduces you very fashionable and designer Cheap Timberland Boots for men and women,kids .Timberland Mens Boots are competitive,acceptable ,quality guarantee,top customer service.。accept Paypal,No Tax. Now. Timberland Boots Sale

  18. moncler says:

    Moncler Gamme Bleu series seems to be bound up with bike culture.Moncler This not only shows in its design but also the pattern printed in the clothes. In this series, designer put in leggings to match some clothes. herve leger This point arouses great controversy in public. It is common that ladies wear leggings to match their long shirts or short dresses.Moncler Jackets If a man put on a legging, he looks a little feminization.Hermes Birkin Somebody do not agree with this. They thought men also should be fashionable.Buy Moncler Wearing leggings is not the right of ladies, but also the fashion of men`s.Christian Louboutin In recent years, many clothes have been more neutralize. Men are paying more and more attention to their dressing.Moncler Clothing Creations in men`s dressing are more and more diversified. Fashion is such kind of thing that at first it will arouse controversy and with acceptance from more and more people it will be popular.Herve Leger dresses Maybe one day there will be more neutralized clothes that men and women can try together.Christian Louboutin Pumps

  19. flora says:

    Vibram FiveFingers Shoesany running shoe on the market today, the Bikila is a breakthrough product that encourages a more natural, healthier, and more efficient forefoot strike. While many folks have been running in their Vibram FiveFingers for years, the Santana Shoes is our first model designed specifically for a more natural running experience.Built on an entirely new platform, the Bikila features a Dri-Lex covered 3mm polyurethane insole (thickest under the ball) and a 4mm anatomical pod outsole design Sebago Shoesthat offers more plating protection, and distributes forefoot impact without compromising important ground feedback essential to a proper forefoot strike running form.Timberland Shoes A more athletic padded collar and topline, Vibram FiveFingers Shoesa single hook and loop closure, 3M reflective surfaces, and tear resistant TPU toe protection finish off this breakthrough design.New Balance ShoesSantana ShoesSebago ShoesTimberland ShoesVibram FiveFingers Shoes

  20. flora says:

    Keen Shoes were first developed in 2003 by Martin Keen and Rory Fuerst. Merrell ShoesNew Balance ShoesThe creators were inspired to create a sandal that would also protect the toes. The answer was the Newport, which was the first shoe of MBT ShoesMerrell ShoesNew Balance Shoes. “From the Newport, Keen created a company built on hybrid innovation, redefining the outdoors and giving back to the community,” according toKeen Shoes website

  21. NFLJerseys says:

    A good website to purchase cheap jerseys is nfljerseys-shopping.com, here football jerseys are sold at discount, most NFL jerseys are having promotion now. Don’t miss such a distinct opportunity.

  22. How happy mbt shoes on sale I

    I fall asleep. “In the MBT Women Kaya Shoes overpass

    You put the ring on MBT Women Kisumu Sandals leather shoes also useless

    I fall asleep. The moment MBT Women Lami Shoes I don’t care about iron bowl of life

    Loudspeakers broadcast is MBT Women M.Walk Shoes far from me

    How happy MBT Women Sports Shoes I

    No matter how MBT Women VOI Shoes much I show, who will take mbt shoes after my death of the cheap supra shoes my happiness

    I fall supra shoes asleep

    So just supra footwear for sale as I

    I didn’t take supra shoes online sleeping, I fell Supra

    Newest asleep

    How happy Supra Skytop I

    In the Supra Skytop NS daytime, in this big cheap supra

    shoes city

    Who is not Supra Society responsible for my Supra Style II sleeping

  23. 1 to keep warm and avoid cold cold. Because the cold virus itself will cause fetal malformations and development, particularly early pregnancy 3 months, affecting fetal heart development. Moreover, many cold medicines treat the fetus is not conducive to growth and development.

    2 away from pets. Many pets such as cats, dogs, who are covered with parasites, such as Toxoplasma gondii, may cause fetal malformations, miscarriage. If you do not accidentally bite, the rabies virus is more detrimental to the fetus. 3 comfortable environment is the ideal environment for your baby’s birth, listen to soft music, flower, books, drawing, and cultivate your baby’s temperament will help. Watch violence, horror and unhealthy video, is taboo in prenatal education.

  24. NFLJerseys says:

    Low price, high quality, free shipping, NFL jerseys and football jerseys are hot sold online, you can save up to 72%. Get more details about cheap nfl jerseys at nfljerseysc.com.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>