Giter Site home page Giter Site logo

belt_reviewer's People

Contributors

tonyhokan avatar

Watchers

 avatar  avatar

belt_reviewer's Issues

Comments

In https://github.com/TONYHOKAN/belt_reviewer/blob/a09a31467ffa48fa61ca9c528ac0fcf386614ca8/app/controllers/comments_controller.rb:

On line 3, event_id assignment is unnecessary.

@comment.save will not throw exception if the save failed, and we are not handling the error case here. If the record fails to save, it will fail silently without anyone noticing. Silent failure is generally bad.
Use @comment.save! instead, or handle the error case manually.

In https://github.com/TONYHOKAN/belt_reviewer/blob/a09a31467ffa48fa61ca9c528ac0fcf386614ca8/app/controllers/events_controller.rb:

Storing user_id in session and reading it directly has no security measures. It is acceptable in this practice but it is extremely dangerous for practical usage and is something to be aware of.

flash[:event] is usually only used for storing string messages rather than objects. Was this practice shown in some guidelines that I'm not aware of?

There is a method called event_comments which is responsible for creating a string to display to the user. That is view logic, so it should not live in the controller. It should live in the view erb instead.

In

@registration = Registration.find(params[:id])
:

Prefer assigning local variable registration = instead of instance variable @registration = if it is not necessary.

Others:
I see that you have some validations in place for some models, and that is good. It is a good practice to also enforce data integrity at the database level. What I usually do is to apply the same validation in the rails model and the db column, but this is not required and can be a judgement call. Though it is usually a good idea to enforce data integrity at db level as I've said.

Also, none of the controllers are guarded by whether the user is authenticated. This means that all pages are accessible to anyone, which is not a desirable situation.

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.