ruby on rails - Field accessing incorrect controller action on onChange -


I have a website and before that I included the design and some variations (layout, script, etc.) was working. Again, I do not know what happened, but instead of any one in the On-Change method line from my chosen area is reaching the "show" action.

I have the following on my new view:

  & lt;% = archive_type ('category', 'id', @ category, 'id', 'name ', {: Prompt = & gt; "Select a category"}, {: onchange =' Gtc:: class = & gt; newAd_box2_inputField '})% & gt;  

It is an idea that it updates with another related field with a related record selected.

The second selection looks like this:

   

In my paths Rb has found me the following:

  map.show "/ announcements /: permalink" ,: Controller => 'Announcements',: Action => Show 'map.new "/ announcements / new" ,: Controller => 'Announcements',: Action => 'New'  

Do anyone know what's going on?

This is your problem:

  map.show "/ announcements /: Permalink ",: admin = & gt; 'Announcements',: Action => 'Show'  

Will use the first route shown in the railways. Rbbe matches the given criteria. When generating a URL for output for the URL, this behavior kicks in both (which is: URL option for the remote_function is in the background) and URL mapping received by the server for functions.

The above pathway will generate / announcments / update_subcategories , so when you view the source in your browser the source will look correct. But when you go to that link, the rail announcement corresponds with the action of the controller's show.

The fix is ​​that what method you are using to define the routes for the announcement controller even if you use the fixed, it should come before the bad route. ( map.show "/ announcements /: permalink" ,: admin = & gt; 'announcements',: action => show' )

If you are comfortable Deciding to add compilation options for definitions are used.

  map.resources: announcements, collection = & gt; {: Update_subcategories = & gt; : Get}  

If you are not using comfortable routes, then add the default route.

  map.connect "/ announcements / update_subcategories",: admin = & gt; "Announcements",: Action => "Update_subcategories"  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -