Thanks.  What should I do to fix it?  Should I re-run the generator?


On Tue, Sep 12, 2017 at 7:10 PM, Rob Biedenharn <[email protected]>
wrote:

> I'm removing most of the "noise" from your output and focussing on the
> gallery-relevant bits:
>
> On 2017-Sep-12, at 17:29 , Joe Guerra <[email protected]> wrote:
>
> *here's the output of my routes... (sorry about the formatting)*
>
>                 Prefix Verb   URI Pattern
> Controller#Action
>             gallery_index GET    /gallery(.:format)
>  gallery#index
>                           POST   /gallery(.:format)
>  gallery#create
>               new_gallery GET    /gallery/new(.:format)
>  gallery#new
>              edit_gallery GET    /gallery/:id/edit(.:format)
> gallery#edit
>                   gallery GET    /gallery/:id(.:format)
>  gallery#show
>                           PATCH  /gallery/:id(.:format)
>  gallery#update
>                           PUT    /gallery/:id(.:format)
>  gallery#update
>                           DELETE /gallery/:id(.:format)
>  gallery#destroy
>
>
> the key bit to notice is that the index route is "named" gallery_index
> because you used:
>
>     resources :gallery
>
> and :gallery is the singular form
>
> You very likely want to say instead:
>
>     resources :galleries
>
> which will give you similar routes *except* from the index:
>
> [ruby-2.4.1p111] //tmp $ cd example/
> [ruby-2.4.1p111] tmp/example (master #%) $ rails g resources Gallery
> Running via Spring preloader in process 61722
> Could not find generator 'resources'. Maybe you meant 'resource',
> 'resource_route' or 'assets'
> Run `rails generate --help` for more options.
> [ruby-2.4.1p111] tmp/example (master #%) $ rails g resource Gallery
> Running via Spring preloader in process 61823
>       invoke  active_record
>       create    db/migrate/20170912230824_create_galleries.rb
>       create    app/models/gallery.rb
>       invoke    test_unit
>       create      test/models/gallery_test.rb
>       create      test/fixtures/galleries.yml
>       invoke  controller
>       create    app/controllers/galleries_controller.rb
>       invoke    erb
>       create      app/views/galleries
>       invoke    test_unit
>       create      test/controllers/galleries_controller_test.rb
>       invoke    helper
>       create      app/helpers/galleries_helper.rb
>       invoke      test_unit
>       invoke    assets
>       invoke      coffee
>       create        app/assets/javascripts/galleries.coffee
>       invoke      scss
>       create        app/assets/stylesheets/galleries.scss
>       invoke  resource_route
>        route    resources :galleries
> [ruby-2.4.1p111] tmp/example (master #%) $ cat config/routes.rb
> Rails.application.routes.draw do
>   resources :galleries
>   # For details on the DSL available within this file, see
> http://guides.rubyonrails.org/routing.html
> end
> [ruby-2.4.1p111] tmp/example (master #%) $ rails routes
>       Prefix Verb   URI Pattern                   Controller#Action
>    galleries GET    /galleries(.:format)          galleries#index
>              POST   /galleries(.:format)          galleries#create
>  new_gallery GET    /galleries/new(.:format)      galleries#new
> edit_gallery GET    /galleries/:id/edit(.:format) galleries#edit
>      gallery GET    /galleries/:id(.:format)      galleries#show
>              PATCH  /galleries/:id(.:format)      galleries#update
>              PUT    /galleries/:id(.:format)      galleries#update
>              DELETE /galleries/:id(.:format)      galleries#destroy
>
>
> Note the routes for index, create, and new ^^
>
> -Rob
>
>
> On Tuesday, September 12, 2017 at 5:03:56 PM UTC-4, Colin Law wrote:
>>
>> On 12 September 2017 at 02:15, Joe Guerra <[email protected]> wrote:
>> > ...
>> > I'm using... in my routes file.
>> >
>> > get resources :gallery
>>
>> Why is the 'get' there?
>>
>> Colin
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/rubyonrails-talk/af2a8305-0b83-4075-8b51-
> f0b610ac31a7%40googlegroups.com
> <https://groups.google.com/d/msgid/rubyonrails-talk/af2a8305-0b83-4075-8b51-f0b610ac31a7%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/rubyonrails-talk/9D2B37D1-18F3-4FC0-9E65-31E73C9DB0D1%40gmail.com
> <https://groups.google.com/d/msgid/rubyonrails-talk/9D2B37D1-18F3-4FC0-9E65-31E73C9DB0D1%40gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmKeJLm3Oj4Y%2B4AYYDEbSC5xfeYvdjzd8tJPQCzXshK9Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to