Code Monkey home page Code Monkey logo

Comments (1)

fgelsomini avatar fgelsomini commented on August 21, 2024

while it is true that you need to remove a level of the nesting, in this case, you would not want to use shallow nesting feature in rails

The reason is - nobody should ever have the opportunity to change a player ID nor will they have the opportunity to view other players from what I gather. so there's no need to have the player resource involved in any nesting at all

this can be achieved in a number of ways, but one example would be using rounds:

The route for rounds should be at the top level and not nested under anything so the URL should simply be

/rounds

in the controller index action:

@rounds = current_user.rounds

The point is, you never need to pass around player IDs because it's always current_user and you have this variable already available in every view and action

The only caveat here is if you want the app to work in a way where players can see other player scores - then the rails shallow nesting option would work well

On Nov 7, 2014, at 3:48 PM, Kerry [email protected] wrote:

Create action is getting too nested bc of nested resources (player/id/round/id/score/id)

Need to fix routes with:

a) shallow nesting: http://nithinbekal.com/posts/rails-shallow-nesting/

b) replacing player w/ current_user


Reply to this email directly or view it on GitHub.

from golf_keeper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.