undefined method ‘link_to’ for #

March 21st, 2008 admin Posted in Merb |

if you want to play with merb you might as well get the latest version (0.9.1) from source. Ezra has promised to stabilize the API for 1.0, and there should be fewer fun suprises between releases from here on out.

A good place to start with the installation instructions: Brainspl.at merb-0-9-1. But once you have it, you may find that you wish the merb team got to the documentation sooner rather than later.

The gist of the install is:

sudo gem install merb -y –source http://merbivore.com
sudo gem install merb-more -y –source http://merbivore.com
sudo gem install merb-plugins -y –source http://merbivore.com

Unfortunately with 0.9.1, after you have installed datamapper and all the requisite gems and are able to get your first view waving hello world, you will probably fail on your first link_to with that special message: “undefined method `link_to’ for #”. this may be as surprising to you as it was to me, because my views worked perfectly as long as that offending link_to was not present. I will save you a little bit of frustration and tell you that you need merb-assets in your init.rb as well… Apparently the zest for modularity can take people in the strangest directions. I am not sure why link_to is in merb-assets, but thats where you will find it.

Maybe by the time merb hits 1.0, the team will put some of those assets back in merb_helpers, but in case you are stuck on this error, change your init.rb and add the following line:

dependencies “merb_helpers”, “merb-assets”

Note that unlike merb_helpers, merb-assets uses a dash instead of an underscore. You can usually find me on #merb in IRC if you have any additional questions.

14 Responses to “undefined method ‘link_to’ for #”

  1. thanks for that! i was scouring the API docs and googling re: link_to & merb. then i pasted part of the error and you came up! i don’t get why a link isn’t in helpers (if it needs to be separate from core) and in assets. i guess merb has opinions too.
    ;-)

  2. I have to second louis on that. Thanks for saving me some hair pulling :)

  3. Thanks a lot.

  4. David Billskog Says:

    Thanks

  5. Thank you so much! I was really having a hard time understanding why this is like this. It would be nice if they would have comment in the code next to where they have the call to link_to.

  6. glad the info is useful. I am going to dip back into merb after 1.0, but it is nice to see so many people trying out the framework!

  7. кто хочет меняться ссылками, пишите

  8. я люблю все ваши слова..

  9. èíòåðåñíî)) ÿ êàê ðàç ïîñìîòðåë ñåé÷àñ 3+2, òàê íàñìåÿëñÿ)) âñåì ðåêîìåíäóþ âñïîìíèòü

  10. ÷òî æå òàì ñìåøíîãî?

  11. нам что-то похожее препод вчера в универе рассказывал, на самом деле тема интересная

  12. списки кандидатов, выдвигаемые партиями политическими и избирательными объединениями (блоками) для выборах в представительные органы, проводимые по пропорциональной избирательной системе.

  13. Хорошая статья, как и все предыдущие. Буду теперь и в дальнейшем следить .

  14. Текст лично мне ничего не дал. Хотя для многих может оказаться реально полезным… :)

Leave a Reply