Variable passing to find function in rails 2 -


I am new to rail. I have under construction in my project There are many Submenu in Menmanu @ Everything is OK to define submenu, but not to find @menmenu. Output is: Main menu can not be found without the main ID

  @submenu = submenu.find (param [[submenu_id]) @mayemenu = manmanu.find (param [: id = & gt; < Submenu.mainmenu_id])  

How can I define the @menmenu, then this is the upper part of the submenu?

I have 2 rails

Rail allows you to regain such relationships:

 < Code> @mainmenu = @ submenu.mainmenu  

But if you want (for some vague reasons or in any other context), to get a menu like you did before, you You must:

  @mainmenu = Mainmen.find_by_id (@ submenu.mainmenu_id)  

How to properly do SQL queries with active records To know: Hna might.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -