36 Matching Annotations
  1. Feb 2020
    1. The :shallow_prefix option adds the specified parameter to the named route helpers:
    2. You can also specify the :shallow option in the parent resource, in which case all of the nested resources will be shallow:
    3. The shallow method of the DSL creates a scope inside of which every nesting is shallow. This generates the same routes as the previous example:
  2. Dec 2019
    1. If you need more advanced React-integration, like server rendering, redux, or react-router, see shakacode/react_on_rails, react-rails, and webpacker-react.
    1. This gem also includes a responders controller generator, so your scaffold can be customized to use respond_with instead of default respond_to blocks. From 2.1, you need to explicitly opt-in to use this generator by adding the following to your config/application.rb: config.app_generators.scaffold_controller :responders_controller
    2. Responders don't use valid? to check for errors in models to figure out if the request was successful or not, and relies on your controllers to call save or create to trigger the validations.
    1. Arguably, the rails-team's choice of raising ArgumentError instead of validation error is correct in the sense that we have full control over what options a user can select from a radio buttons group, or can select over a select field, so if a programmer happens to add a new radio button that has a typo for its value, then it is good to raise an error as it is an application error, and not a user error. However, for APIs, this will not work because we do not have any control anymore on what values get sent to the server.
    2. liberal_enum :kind
    1. When the controller creates the user, instead of adding a validation error to the record, it raises an exception. How to avoid this?
    2. I really dislike the reasoning as stated in the issue listed above. Since the value is coming over the wire, it should be treated the same as a freetext input where the expectation is to validate in the model and not the controller. This is especially true in APIs where the developers have even less of a say as far as expected input coming from form data (for example).
    3. In case anyone wants a hack, here is what I came up with.
  3. Nov 2019
  4. Sep 2019
  5. Aug 2019
  6. Jun 2019
    1. At each stage of developing the sample application, we will write small, bite-sized pieces of code—simple enough to understand, yet novel enough to be challenging. The cumulative effect will be a deeper, more flexible knowledge of Rails, giving you a good background for writing nearly any type of web application.
    2. Following the scaffolding approach risks turning you into a virtuoso script generator with little (and brittle) actual knowledge of Rails.
  7. Nov 2016
    1. "American Idiot" - Green Day

      Green Day's first number one album since 1994's multi-platinum Dookie--which is likely due to the fact that while the lyrics may have a deeper meaning, the hooks are still there, and they are played with the same intensity that made the group famous more than a decade ago. Spin said the title track was "Green Day's most epic song yet.

    2. Now everybody do the propaganda,And sing along to the age of paranoia.

      The work challenges listeners to dig deeper than the high-octane guitars and thundering drums that drive the record's jubilant pop sheen. This is a multi-layered, literate narrative that effectively wields anger, wit, and bombast to expose the ugliness that seeps below the surface of this country's patriotism, commercialism, and nationalism.

    3. We're not the ones who're meant to follow.

      "A lot of rock music lacks ambition. Rock has become stagnant. There are a lot of bands that aren't doing anything differently than what's currently going on in pop music--like issuing a single, putting out a record, making a video, and hopefully getting on a tour with a bigger band. I think the reason hip-hop has become so much bigger than rock lately is because those artists are much more ambitious, and they are making records that have a concept and characters. They sound like a script." ~Billy Joe Armstrong

    4. Television dreams of tomorrow.

      "All my songwriting is about creating a statement and taking action. On American Idiot, it's reflecting on what's going on in the world right now." ~Billy Joe Armstrong

  8. Jan 2016
    1. require 'active_record/connection_adapters/postgis_adapter/railtie'

      The following worked better in my setup:

      require 'active_record/connection_adapters/postgis/railtie'