Tuesday 15 July 2014

ruby on rails - uninitialized constant -- model within controller -


I have an app in which the club has many locations: Club & amp;

I am trying to pre-load the club in the controller so that all the action is from that club.

Routes are nested; However, in the Places controller, this club model is not getting what I am doing?

routes.rb

  Namespace: Administrator resources: clubs use resources: end of locations  < / Pre> 

club.rb class club & lt; ActiveRecord :: Base is_many: membership has_many: users have_many: users are_many: places #accepts_nested_attributes_for: end of locations

admin / locations_controller.rb

 < Code> Classroom Administrator: Location Controller & lt;   

In addition, in the end: what's wrong in my routes, who is not looking for it. Administrator / club / location controller in locations? I'm not sure that this is part of the problem.

From Rake Routes

  admin_club_locations POST / admin / clubs /: club_id / location (.: Format) Admin / place # create new_admin_club_location GET /admin/clubs/:club_id/locations/new((.:format) Admin / Location # New edit_admin_club_location Received / Administrator / Club /: club_id / locations /: id / edit (.display) Admin / Location # edit admin_club_location PUT /admin/clubs/:club_id/locations/:id(.:format) admin / locations # update DELETE / admin / clubs /: club_id / locations /: ID (.: This is probably possible on  club  Looks    

/ code> model worsh You can try:

  def load_club @club = :: Club.find (params [: club_id]) expiration   < / Div> 

No comments:

Post a Comment