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.
May 6th, 2008 at 10:01 pm
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.
July 2nd, 2008 at 5:11 am
I have to second louis on that. Thanks for saving me some hair pulling
August 12th, 2008 at 1:58 pm
Thanks a lot.
August 23rd, 2008 at 5:15 pm
Thanks
August 24th, 2008 at 11:28 pm
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.
August 26th, 2008 at 12:46 am
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!
December 13th, 2008 at 3:06 pm
кто хочет меняться ссылками, пишите
December 14th, 2008 at 3:49 pm
я люблю все ваши слова..
December 16th, 2008 at 4:01 pm
èíòåðåñíî)) ÿ êàê ðàç ïîñìîòðåë ñåé÷àñ 3+2, òàê íàñìåÿëñÿ)) âñåì ðåêîìåíäóþ âñïîìíèòü
December 16th, 2008 at 4:47 pm
÷òî æå òàì ñìåøíîãî?
December 16th, 2008 at 6:17 pm
нам что-то похожее препод вчера в универе рассказывал, на самом деле тема интересная
July 23rd, 2009 at 11:47 pm
списки кандидатов, выдвигаемые партиями политическими и избирательными объединениями (блоками) для выборах в представительные органы, проводимые по пропорциональной избирательной системе.
August 18th, 2009 at 3:27 am
Хорошая статья, как и все предыдущие. Буду теперь и в дальнейшем следить .
August 22nd, 2009 at 10:07 pm
Текст лично мне ничего не дал. Хотя для многих может оказаться реально полезным…