# Dynamic Menu This gem provides an easy way to generate a menu that changes according to the controller action. It stores everything in an array which can later be accessed via the view. #Getting Help *Email me directly at support@pessetto.com and I will see what I can do #Installation The latest version, and probably the best to use, is 2.0.0 which no longer requires you to manually declare the array. To install just put the following in your Gemfile and run bundle install or bundle update: ```ruby gem 'dynamic_menu','~>2.0.0' ``` Note: This gem was developed for Rails 3 and will most not work with anything under Rails 3. ##Getting Started This gem features an engine that will automatically load it into your controllers. However, you will need to include in your views ```erb <% @actionMenuItems.each do |menuitem|%> <%= menuitem %> <%end%> ``` Note: your array must be @actionMenuItems, do not define this in the controller, the Gem will do it automatically for you unless you are using a pre-2.0 release. To add a link in your menu from your controller it is just a matter of using newmenuitem() Example ```ruby def index #...code here newmenuitem("New Thing",new_thing_path) #...code here ``` ##Functions There is only one function, newmenuitem, that this gem currently has, but can have various values sent to it. * newmenuitem(name,link) provides a regular get link to to link and displays name on the menu * newmenuitem(name,link,:delete,confirm) will send a delete request to link with the confirmation message of confirm * newmenuitem(name,:submit) will create a link to submit the form on the page assumming you don't want the regular button and listen for an enter via JavaScript