Thursday 15 September 2011

routes - Rails Routing to New associated model -


I have apps that have a family who go to my agency and enter each time during a home visit. I am here. I select the home in the index of families and open the scene of the tour which is in the visit model in my index to select my house and creates a new journey, I will be on the index view for my homes The following codes follow:

  = LINK_TO 'go', new_household_visit_path (home), category: 'btn btn-mini'   

show rack routes :

  new_household_visit received /   
  http: // http: // local host: 3000 / d / 5 / visit / new   

I have a simple form in this view, such as:

  = simple_form_for [home, travel], Url: new_household_visit_path do F | % H2 Domestic: # {home name}   

Now when I fill out the form and try to save with the submissions:

  No route Now I notice that I have a GET in the Rack Roots, but there is no post but I am still not sure what my problem is.  

Roots RB shows:

  Resources: Resources for homes are: resources visits: end of neighbors   

I changed my simple form Call:

  = Simple_for__for_for [home, travel], url: home_visits_path | F |   

I am creating my form, but I get an error on saving:

  missing the required parameter: home   < P> Log shows:  
  to get started "/ homes / 8 / visits" on 127.0.0.1 2013-06-22 07:58:34 -0400 visits by controller # Create as HTML parameter: {"UTF8" => "One ????" "Authenticity_token" = & gt; "HCivpI4SLQTzj2VlwibssNEw / o69jIt4J54 / hjVPgJ4 =", "Go" => {"Visited_on (1m)" = = "2013", "visited_on (3i)" = = "22", "visited_on (2i)" = = gt; "6", "neighbor_id" = & gt; "46", "Starch" => "Beans", "Grain" => "", "OPTION1" => "," "," Note "=> "}," Committed "=> Create "" home_id "= & gt", = & gt; "items_received"; Select "8"} User Load (0.4ms) "Users". * "Users" from Where "Users" Select "Id" = 1 LIMIT 1 (0.2ms) BEGIN Neighbor Load (0.8 mms) "Neighbors". * From "neighbors" where "neighbors" "ID" = 46 by last_name ASC limit 1 (0.2ms) ROLLBACK rendered arrival / _newkhtmlkhaml (L29k7ms) rendered new.html.haml safe arrival / layouts / application Order (136.2 mi.) Rated Text template ( 0.0 mi) In full 400 back configuration 1126ms (view: 7.7ms | I think I'm getting closer to   

Let's say you're using standard routes like:

  Resources: Family Resources: End of Visit   

Then you want to post rack You will probably find something similar to running: gET / household / Haushold_aidi / visits (Grelu_saits. format) visits # Index Post / households / Haushold_aidi / visits (.: format) visits # Create get new_household_visit / houses: Grelu_aidi / visits / new. format) Visit # new edit_household_visit received / households/ahousehold_id/visits/:id/edit(.:format) visits # edited home_visit Received /households/:household_id/visits/:id(.:format) visits # show PUT / household /: Haushold_aidi / visits /:id(.:format) visits # Update Delete / household / Haushold_aidi / visits /: :( .: Format) Visit # Delete

You will see that only one post request is accepting home_view . new_household_visit is used only to get the form.

No comments:

Post a Comment