Thursday, April 12, 2007

Tips for Developing Mephisto Plugins with Liquid and Rails

When I was writing a contact form plugin for Mephisto, I had a lot of trouble finding documentation and ended up reading lots of code and experimenting. That was fun, but fairly slow, so I hope this post can save future plugin developers time, and help them avoid some of the gotchas I stumbled over.

Repository Directory StructureAt the most macro level, your repository needs to have a 'plugins' directory, and then a directory named after your plugin. Eg,.../plugins/my_new_plugin/...If this is not set up correctly, your plugin will not be able to be installed via 'ruby script/install plugin ' method.

Liquid Plugins Directory and Init.rbAs you probably know, Mephisto uses Liquid for page templates. Liquid can be extended with new tags/blocks. The way to do this in a plugin is to set up a 'mephisto/liquid' directory with your extensions in it. See example here. So that's great, but you also need to register it in init.rb. Here's the contact form's init.rb - check out the line about 'register_tag'.

Mephisto Plugin ClassMephisto trunk now has a base class for plugins - Mephisto::Plugin. Inheriting from this allows you to set up routes to brand new controllers you create. See contact form example here. This opens the door to writing Mephisto plugins which do postback and processing. It is also possible to add in tabs and forms in the administration interface. Rick's feedback plugin shows how to do this.

Using Liquid Templates from Your PluginOne of the trickiest bits was getting the plug-in controller to render a liquid template. This is important if you want your additions to Mephisto to have the same layout and colours as the rest of the site. The way I'll outline below works fine, but it is not ideal. Hopefully there is a better way to do this (eg, some sort of Liquid API for Mephisto plugins).. if you know how a better way, please let me know!

I had my plugin controller inherit from the Mephisto ApplicationController to gain access to the method 'render_liquid_template_for'. You can see the code here. However, this led to thorny problems where the plug-in classes were getting loaded only once when the server started, but Mephisto (and the ApplicationController) were getting reloaded for every request. First request worked fine, but nasty errors were spat out on the second and subsequent requests. To resolve this, I removed the plug-in from the 'load_once_paths'. You can see how to do this in the init.rb.

Models, Views & Controllers Directories and Init.rbOkay, this is open to personal taste. I like to have similar directories in my plugin to a normal app. Eg, separate directories for controllers, model, etc. This causes a bit more work, as you need to add the extra directories to various global path variables. For an example of how to do this, take a look at 'models_path' and 'controllers_path' in this init.rb and the physical directory structure of the contact form's lib directory.

Thanks for posting the details as well as the code. It's helping me already! I'm in Chicago and it sure seems like all of the ThoughtWorkers I meet are really, really, really, passionate about their code.

Me and my friend were arguing about an issue similar to this! Now I know that I was right. lol! Thanks for the information you post. Please come visit my site Palmdale California yellow pages when you got time.

Couldn't be written any better. Reading this post reminds me of my old room mate! He always kept talking about this. I will forward this article to him. Pretty sure he will have a good read. Thanks for sharing! Please come visit my site Hayward California business directory when you got time.

China Wholesale has been described as the world’s factory. This phenomenom is typified by the rise ofbusiness. Incredible range of products available with China Wholesalers “Low Price and High Quality” not only reaches directly to their target clients worldwide but also ensures that wholesale from china from China means margins you cannot find elsewhere and buy products wholesaleChina Wholesale will skyroket your profits.

I usually don’t leave comments!!! Trust me! But I liked your blog…especially this post! Would you mind terribly if I put up a backlink from my site to your site? Feel free to check out my site Shenzhen China when you got time.

I enjoyed reading your work! GREAT post! I looked around for this… but I found you! Anyway, would you mind if I threw up a backlink from my site? I would love some feedback on my site China Tianjin when you got time.

I usually don’t leave comments!!! Trust me! But I liked your blog…especially this post! Would you mind terribly if I put up a backlink from my site to your site? I would love some feedback on my site resource when you got time.

There was this guy who believed very much in true love and decided to take his time to wait for his right girl to appear. He believed that there would definitely be someone special out there for him, but none came.Every year at Christmas, his ex-girlfriend would return from Vancouver to look him up. He was aware that she still held some hope of re-kindling the past romance with him. He did not wish to mislead her in any way. nike shoxsSo he would always get one of his girl friends to pose as his steady whenever she came back. That went on for several years and each year, the guy would get a different girl to pose as his romantic interest. So whenever the ex-girlfriend came to visit him, she would be led into believing that it was all over between her and the guy. nike womens shoes The girl took all those rather well, often trying to casually tease him about his different girlfriends, or so, as it seemed! In fact, the girl often wept in secret whenever she saw him with another girl, but she was too proud to admit it. Still, every Christmas, she returned, hoping to re-kindle some form of romance. But each time, she returned to Vancouver feeling disappointed.Finally she decided that she could not play that game any longer. puma mens shoes Therefore, she confronted him and professed that after all those years, he was still the only man that she had ever loved. mens puma shoesAlthough the guy knew of her feelings for him, he was still taken back and have never expected her to react that way. He always thought that she would slowly forget about him over time and come to terms that it was all over between them. nike shox Although he was touched by her undying love for him and wanted so much to accept her again, he remembered why he rejected her in the first place-she was not the one he wanted. nike 360 air maxSo he hardened his heart and turned her down cruelly. nike running shoesSince then, three years have passed and the girl never return anymore. They never even wrote to each other. NIKE air shoes The guy went on with his life..... still searching for the one but somehow deep inside him, he missed the girl.On the Christmas of 1995, he went to his friend's party alone. "Hey, how come all alone this year? Where are all your girlfriends? What happened to that Vancouver babe who joins you every Christmas?", asked one of his friend.nike air max He felt warm and comforted by his friend's queries about her, still he just surged on.Then, he came upon one of his many girlfriends whom he once requested to pose as his steady. He wanted so much to ignore her ..... not that he was impolite,wholesale nike shoes but because at that moment, he just didn't feel comfortable with those girlfriends anymore. nike shox torchIt was almost like he was being judged by them. The girl saw him and shouted across the floor for him. Unable to avoid her, he went up to acknowledge her."Hi......how are you? Enjoying the party?" the girl asked."Sure.....yeah!", he replied.She was slightly tipsy..... must be from the whiskey on her hand.

Once upon a time, there was a mouse father.He wanted to marry his daughter to the greatest person in the world.But, who was the greatest person in the world?Oh! puma ferrari shoescheap nike shoesThe sun! He must be the greatest person in the world.The mouse father went to talk to the sun."Hello! Mr. Sun. puma shoesferrari shoesI know you are the greatest person in the world.Would you marry my daughter?""What? I'm not the greatest person in the world. The greatest person is the cloud.If he comes out, I’ll be covered."nike shox nzUgg BootsThe mouse father went to talk to the cloud. “Hello! Mr. Cloud. I know you are the greatest person in the world. Would you marry my daughter?” nike 360 air maxnike shox shoes“What? I’m not the greatest person in the world. The greatest person is the wind.If he comes out, I’ll be blown away.”cheap puma shoespuma drift catThe mouse father went to talk to the wind. “Hello! Mr. Wind. I know you are the greatest person in the world.Would you marry my daughter?” “What? I’m not the greatest person in the world. The greatest person is the wall. If he comes out, I’ll be stopped.”cheap nike shoxnike air max 360The mouse father went to talk to the wall. “Hello! Mr. Wall. I know you are the greatest person in the world. Would you marry my daughter?” “What? I’m not the greatest person in the world. The greatest person is YOU, the mouse.” “The greatest person in the world is … mouse?” “Yes, the greatest person in the world is mouse. See? If mouse comes out, I’ll be bit!” nike air maxpumas shoesThe mouse father was very happy. He finally knew mouse was the greatest person in the world. He would marry his daughter to the handsome mouse next door. cheap jeanscheap levis jeansed hardy jeans

I am not really sure if best practices have emerged around things like that, but I am sure that your great job is clearly identifed. I was wondering if you offer any subscription to your RSS feeds as I would be very interested and can’t find any link to subscribe here. Please come visit my site Business Phone Directory of Dallas Texas TX when you got time.

I am not really sure if best practices have emerged around things like that, but I am sure that your great job is clearly identifed. I was wondering if you offer any subscription to your RSS feeds as I would be very interested and can’t find any link to subscribe here. Please come visit my site Resource Guide Dallas Texas TX when you got time.

. Since I’m new to blogging, these articles are greatly appreciated; very useful and informative blog and every body must visit this blog. Please come visit my site City Guide Corpus Christi when you got time

This is just another reason why I like your website. I like your style of writing you tell your stories without out sending us to 5 other sites to complete the story. Please come visit my site Nashville Phone Numbers when you got time.

This is just another reason why I like your website. I like your style of writing you tell your stories without out sending us to 5 other sites to complete the story. Please come visit my site Find Business Nashville when you got time.

Personally, I prefer a Moncler shop online that doesn’t advertise itself as such, largely because I prefer to engage with winter only theoretically. I love cold weather; I just dislike participating in activities that require cold weather. I am at no risk of getting caught underdressed in Gstaad, or on Hunter Mountain, or even in a steep bit of Riverside Park. The Moncler Jackets for women , long the preserve of skiers (the company was founded in 1952), began appearing on fashionable hip-hop crowds a few years ago, widening the company’s reach beyond specialty shoppers. Moncler men jackets come in a slate of bold and sometimes disquieting colors, often shiny, and, for winter wear, are relatively slimming.

The consul is also required to send annually to the Secretary of State for Foreign Affairs mbt trainers a return of the trade at the ports within his consulate ; and to transmit quarterly a weekly account of the prices of agricultural produce, with the course of exchange mbt shoes clearance, and any remarks connected with these subjects which he may consider necessary. He is further required to acquaint his own government with the appearance of any contagious disease five finger shoes at the place of his residence ; to afford relief to any distressed British subjects thrown upon the coast 5 finger shoes, or reaching by chance any place within his district; and to furnish intelligence, obtain supplies, and generally assist any king's ships coming within his consulate.The consuls appointed by our government are generally British subjects; but this is not an invariable rule. Previous coach bags outlet to the year 1814, the greater part of the English consuls abroad, who held commissions under the crown, were merchants at the respective places of their consular residence. Many of those consuls had no salary from government; their emoluments consisted of fees, which they levied upon the tonnage of British ships, aud upon the value of their cargoes. This mode ut remunerating these officers having created dissatisfaction among the commercial classes, a new system was introduced in the year 1826', and an act of Parliament was passed to abolish all consular fees on tonnage and cargoes, and to enable the cruwn to give remunerating salaries to consuls. According coach outlet store online to the system fouuded upon the act of 1820', it was determined " that British consuls should not be in any way concerned, directly or indirectly, in commercial pursuits." This system was acted upon with some few exceptions until the year 1832, when a very considerable reduction was made in the salaries assigned to them, and " permission was given to engage in commercial pursuits," as a set-off against the reduction of salary.

Y te vi bailar bajo la lluviay saltar sobre un charco de estrellasObama Is Lying<1>When was the last time the MSM took a Republican's side in a fight over credibility with a Democratic opponent?Microsoft OfficeOffice 2010Well, it has been a while.Microsoft Office 2010However, conservatives have little to grumble about in the recent Office 2007face-off between Barack Obama and John McCain over McCain's statement thatte vi bailar bajo la lluviaesperando la luna llenaVolverás a reírte de verasMicrosoft Office 2007troops might have to remain for "100 years" in Iraq "as long as Americans are not being injured or harmed or wounded or killed" afterOffice 2010 keyfighting had concluded, Office 2010 downloadMost recently, ABC's Jake Tapper noted that at least on three occasions Obama had personally said that McCain favored cuando creas que estaba perdidovolverás a reírte de verascontinued fighting in Office 2010 ProfessionalIraq for 100 years. Tapper concluded that "Obama has in the past distorted McCain's comments" and "that he is violating his own stated si te quedas conmigoTe vi bailar bajo la lluviaesperando la luna llente vi llorar bajo la lunMicrosoft outlookaspirations...[b]ecause not only has he distorted what McCain said, he is not being honest about having made those distortions."Outlook 2010Tapper is not the only MSM reporter to point this out, Windows 7of course. It is not every day that the RNC sends around e-mail blasts quoting Frank Microsoft outlook 2010Rich ("Barack Obama and Hillary Clinton should be ashamed of themselves for libeling John McCain") and reports from the Chicago Tribune,

All those sequels will be fed to Starz as part of the new distribution deal. Other Weinstein Co. films coming to Starz include critically acclaimed "The King's Speech," and "Blue Valentine." nice and cheap ugg boots is on display right now at Harrods ugg clearance in London, but once released, will there be a market for it? The new green luxury car gives the environmentally conscious executive cheap uggs clearance the option of powering the CT 200H by either electricity orjordan basketball shoes by regular petrol. Lexusugg women is banking on the belief that there is a growing demand for a greenJordan Fusions. vehicle in the luxury car market.

Great info.I like all your post.I will keep visiting this blog very often.It is good to see you verbalise from the heart and your clarity on this important subject can be easily observed. beachbody coach | insanity workout | P90X workout | revabs Thanks again!

Much of our wardrobe true religion jeans outlet may contain an incredible wcxyewc0vsk amount of formal outfits that we usually wear at work or at business meetings. However, true religion sale when we get back home and maybe want to go out in the city or to some friends’ true religion jeans sale party, we feel like wearing something that feels both relaxing and trendy at the same time. True Religion jeans and Butterfly Dropout clothing can offer the solution to such a need. Butterfly Dropout clothing collections can provide true religion jeans for men shorter dresses that you can wear as tops over jeans available with a True Religion jean sale.

In the end, true religion mens jeans though you may give a greater amount of money for the acquisition of mens true religion jeans a pair of jeans, they will still prove to be one of the least true religion kids expensive manners of staying relaxed in your clothes while looking smashingly stylish. This happens particularly if you can combine a pair of skinnier jeans from the True Religion jean sale with true religion jeans cheap the soft look of a top from the Butterfly Dropout clothing collection.

I’ve truly enjoyed reading your blog posts. You obviously know your stuff. I also really like it that your website is very simple to navigate. I have bookmarked it in my favorites and will for sure be back for more.

Most of these post are always inspiring and I prefer to read quality articles so I am happy to find many good details here in the post, writing is just fantastic.Wonderful post! I've bookmarked your weblog as well considering I found it issurely educational and I liked reading your posts.yest infection home remedymale yest infection treatment

I could tell how great you are in your field of interest. You could relate in each detail very well. Thank you for spending a time on sharing such informative writings to us. I will bookmark your page and looking forward to read some more of your writings soon.

I could tell that we’re on the same interest and obsession. Good to know someone I could share my ideas. Looking forward to know and learn some more from you. I'll be glad to share my own thoughts to you soon. Thank you for sharing such valuable articles. More power!

All the cheap Louboutin Heel for selling within our shop would be to provide services of first-class quality. you can take satisfaction in a whole lot more discount.The christian louboutin evening Platform whole lot could be the good and stylish one.They occur in fascinating style and design and stylish christian louboutin peep toe.These women's christian louboutin pumps are luxury and noble.The pump display formal, a whole lot more display its gorgeous gloss and honour. good heel with thick soles collocation to strengthen all round modelling, carry into some mysterious alluring taste! This pairs of large christian louboutin wedges features a pretty significant part for women's fabulous entire body figure, display their fantastic figure and stylish attitude.Welcome to share Christian Louboutin Store!

The Louboutin Shoes Sale is planned using the ladies. offered the fact that pumps was born, the ladies lifestyle turn into colorful. The christian Louboutin 2011 Pumpswill be the god's masterwork. Who invited the Christian Louboutin Wedges ? Seldom people knew, but I think each and every and every lady will be grateful for him. between the countless pumps,the Christian Louboutin Shoescould be probably the most exceptional ones. The stylish pattern, the delicate design all mold the ladies perfect leg profile. Flowers inside the spring of 2011 creeping, up from frizzy hair to outfits hold on to footwear, have experienced a brilliant up. on this type of the glamor, spring and summer time flowers now here. Romance is really a woman's mood, exquisite flowers just appropriate of expression within our gestures, the woman, how can we not adore the romantic temperament to make certain which they distributed the flowers do? 2011 flowers bloom will get satisfaction from numerous poses! The Christian Louboutin New Sandalsalso can adds the hright in the ladies, it hold shock toward short lady. especially the red-colored lone in the louboutin heels, beauty and sexy, different ladies are crazy. The red-colored sole, andChristian Louboutin Mensis a very distinctive design, its design reflects its style. You put on it, that means you have its style.the earliest attribute in the Sale Louboutin stroe.

Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with extra information? It is extremely helpful for me.assamhow to attract a girlcustomer care number

Having been simply browsing for pertinent blog posts intended for a project research and My partner and i happened to stumble on yours. Many thanks for the useful information!car title loan | rim financing

I promise this would be beneficial for most of the people. thanks for sharing.This is definitely a subject thats close to me so I am glad that you wrote about this. The aricle is very interesting. You are a very experienced writer. how to get rid of cold sores fasthow do you get cold sores

Not Only The Appearance, Design, But Also The Inspiring Of The Master,The Nike Shoes Us Are The First Class Sports Shoes. Buy Nike Shoes From Us Which Will Keep The Smell Mesh Go Such As Air Max Griffey 1.Many Female People Also Like Various Sports, And They Are Crazy On Such Good Nike Shoes. Nike Air Max Shoes. With A Major Unit In The Heel Hovercraft That Is Visible From The Side Of The Tongue In Most Models To Avoid Injuries And Longevity! Your Feet, Will Keep Dry And Comfortable.Action For The Cheap Air Max. I Am Happy To Know That You Have Read The Article.Now I Belive That You Will Like The Following Fashion Shoes We Provide For You.Don't Hesitate To Choose The Christian Louboutin Outlet Online As Well As The Christian Louboutin Discount Which Have The Unique And Well-Designed Shoes Favored By The World, Signed With The Christian Louboutin Red Soles Of The Mark, Giving High Heels And Covetable Accessories.Hurry Up!We Will Change You Into A Gorgeous Girl! Most Important,The Product We Provide Are All Fashionable As Well As High Quality Elegant Shoes.No Tax And Fast Delivery As Well As Good Customer Service.Just Do It.Our Blog Provide More Details: http://www.christianlouboutin-outlet-online.net/blog/wp-admin/edit.php

Yemek Tarifleri Thanks for this post – I have struggled with this as I have NO comments yet on my blog and in some ways feel badly about that (until i read your posts about this) and yet I see there is more that I can do. thankss.

Yemek Tarifleri Thanks for this post – I have struggled with this as I have NO comments yet on my blog and in some ways feel badly about that (until i read your posts about this) and yet I see there is more that I can do. thankss.

I been going through distinctive websites each day and yours is definitely an intriguing an individual. We might vary in beliefs and fascination however i unquestionably could relate in your way with words. Web DesigningProperty in Noida

That guy who believed very much in true love and decided to take his time to wait for his right girl to appear. He believed that there would definitely be someone special out there for him, but none came.get your ex back !venapro reviews

I impressed greatly that the way you have written such great article. I got many reference about this topic but your one is wonderful. When I started to read article I was thinking about the way you present such great topic. By the way could you please post more article on such topic ? I really appreciate it.

I am expecting the same best efforts from you later on as well. Actually your artistic writing skills has influenced me a lot.These post are always impressive and I prefer to read quality content so I am happy to find many good points here in the post, writing is simply excellent.how to get your ex boyfriend backhome remedies for hemorrhoids

UGG has set a boot sensation around the globe. People of all ages and profession are becoming intrigued with one of these sheepskin footwear in the land here. In the past, the sheepskin boots were first of all worn by shepherds for defense against the inclient weather.UGG Outlet However, it's thought these flat soled fur-lined boots have managed to get in to the leading edge world of fashion since war aircraft pilots put on due to the fact to have their ft warm in high altitudes along with the viewers make use of the boots to warm-up their ft following a chilly dip in to the sea.Cheap Ugg UK Undeniably, ugg footwear experience again worldwide people' s hidden adoration for casual style and comfort in ultimate.Like a mainstay of fashionable UGG selection, UGG shorts boots are not going anywhere soon.Ugg Classic Boots They're comfortable and in addition, they keep the ft totally dry.Ugg Classic Boots Due to the fact happen to be produced in Australia and therefore are completely constructed of sheepskin. Every UGG devotee will find assorted types of calf shaft height in a number of dimensions and colours.ugg classic boots And 2010 trends are noticed the solely style short sheepskin footwear the following. Check thi out very quickly.UGG Classic Short Boots: This style conveys an easy but classic feel.uggs clearance consists of Genuine Australia sheepskin and made of woll material that may keep your ft dry and warm since it's character, and it is Avoi outsole signed UGG Logo design offers lighweight comfort.Discount Uggs Boots Therefore,The sleek yet sleek appearance is globally outfitted up women of any age around the world. Not just adult women, kids and males may also pamper their ft in Classic Short UGG from Australia. They are available in multicolor from teal to orange, to brown and also the always-reliable black. A glance of the vibrant colored classic short having a skinny jean, a pleated skirt or other tight pants is going to be extremely popular this season.gh uk You may also alter your thing by putting on the cuff up or lower with Classic Short UGG.Ugg Boots Outlet They'd look wonderful with a set of the brand new skinny jeans that are very popular this winter months.Uggs Bailey Button Boots: This is actually a sublime version among fashionable ugg collections.Babyliss Hair Straightener Much like so completely different from classic Uggs due to their attractive side split and distinctive wooden UGG button.Babyliss Hair StraightenerGhd Australia

Very useful analyze, I’ve made some bets on them this season! Thanks for helping me too see the situation objective. And hey, don’t be sad for the results, it could be worse anytime! bonus betting and free betting tipsbet365 and bwin Thanks for the information! I loved it. and I do think quality matters! online bookmakers Wow. Thanks a million for that helpful post. Excellent tips, and the performance is looking much improved. free bets and bookmakers reviews

Thank you for sharing information about Mephisto Plugins. I really appreciate for posting every little details and the code. I wish all bloggers where as organized as yours. I wish you the best of luck.

Hello James! Wow! Thank you so much for these tips on how to develop Mephisto plugins with Liquid and rails. This will surely help me and all other people. I've been searching for informative blogs like this. Thanks so much.

Thanks this made for intresting reading. I love your wordpress theme, i frequently come back here and i dont know why. I just seriously like your web site lol… I just now read something simular to this on That Are i believe they may of stolen the blog?

I've enjoyed reading this blog very much. It's good to see that you are all enjoying yourselves and making a real difference to peoples lives. Looking forward to further contributions, thanks again.[url=http://www.howtogetyourexbackmym3.com] Get your ex boyfriend back[/url][url=http://www.howtogetyourexbackmym3.com] Get boyfriend back[/url][url=http://www.howtogetyourexbackmym3.com] How to get your ex back[/url]

For this reason players have a tendency to be tempted to get Gold WOW through safe web internet sites. Unless you will be an achieved player, accumulating the Gold for WOW you will need could possibly be a frustrating procedure.

Increase credit score and save money. Your credit score largely determines the lenders available and the interest rate at which they will lend. Fix credit and expand the number of lenders willing to compete for your loan.

Okay, it is open to exclusive taste. I want to own equivalent Cheap RS Goldsites in my plugin to some typical app. Eg, individual sites for controllers, model, etc. This delivers about a little bit much more work, when you must raise the additional Cheap Runescape Goldsites to different throughout the world route variables.s also a breeze.