How to create a custom create route in railsCan Rails Routing Helpers (i.e. mymodel_path(model)) be Used in Models?A concise explanation of nil v. empty v. blank in Ruby on RailsUnderstanding the Rails Authenticity TokenHow to write a switch statement in RubyHow can I rename a database column in a Ruby on Rails migration?How do I get the current absolute URL in Ruby on Rails?Rails layouts per action?Rails Restful Routing and SubdomainsHow to run `rails generate scaffold` when the model already exists?Best practices to handle routes for STI subclasses in rails

Vehicle routing benchmark instances

Going to France with limited French for a day

practicality of 30 year fix mortgage at 55 years of age

Fuel sender works when outside of tank, but not when in tank

How can this Stack Exchange site have an animated favicon?

Hilbert's hotel: why can't I repeat it infinitely many times?

Why does (inf + 0j)*1 evaluate to inf + nanj?

Concrete example of Vertex Cover to Subset Sum reduction

Comma Code - Automate the Boring Stuff with Python

Get Max value comparing multiple columns and return specific values

Can you cast Dispel Magic on a Shadow Monk's Silence?

What is the meaning of "heutig" in this sentence?

Can the U.S. president make military decisions without consulting anyone?

Is it impolite to ask for halal food when traveling to and in Thailand?

What benefits does the Power Word Kill spell have?

Why does this image of Jupiter look so strange?

On the meaning of 'anyways' in "What Exactly Is a Quartz Crystal, Anyways?"

Is it a good idea to leave minor world details to the reader's imagination?

How do pilots align the HUD with their eyeballs?

Can anyone put a name to this Circle of Fifths observation?

Proper way to shut down consumer

Could Apollo astronauts see city lights from the moon?

Is there any iPhone SE out there with 3D Touch?

Do I have advantage with Riposte when moving away from a flanked enemy and triggering an opportunity attack?



How to create a custom create route in rails


Can Rails Routing Helpers (i.e. mymodel_path(model)) be Used in Models?A concise explanation of nil v. empty v. blank in Ruby on RailsUnderstanding the Rails Authenticity TokenHow to write a switch statement in RubyHow can I rename a database column in a Ruby on Rails migration?How do I get the current absolute URL in Ruby on Rails?Rails layouts per action?Rails Restful Routing and SubdomainsHow to run `rails generate scaffold` when the model already exists?Best practices to handle routes for STI subclasses in rails






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I currently have a create method in an invoices controller. However i need another one, which is called 'create_inappointment_invoice'. I was wondering what the syntax was in the routes file to create a route in relation to this. I basically want the same route as this resources :invoices, controller: "admins/invoices", only: [:create] but changing the name of the controller action. Thanks










share|improve this question






























    0















    I currently have a create method in an invoices controller. However i need another one, which is called 'create_inappointment_invoice'. I was wondering what the syntax was in the routes file to create a route in relation to this. I basically want the same route as this resources :invoices, controller: "admins/invoices", only: [:create] but changing the name of the controller action. Thanks










    share|improve this question


























      0












      0








      0








      I currently have a create method in an invoices controller. However i need another one, which is called 'create_inappointment_invoice'. I was wondering what the syntax was in the routes file to create a route in relation to this. I basically want the same route as this resources :invoices, controller: "admins/invoices", only: [:create] but changing the name of the controller action. Thanks










      share|improve this question














      I currently have a create method in an invoices controller. However i need another one, which is called 'create_inappointment_invoice'. I was wondering what the syntax was in the routes file to create a route in relation to this. I basically want the same route as this resources :invoices, controller: "admins/invoices", only: [:create] but changing the name of the controller action. Thanks







      ruby-on-rails ruby routes






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 28 at 17:29









      b.herringb.herring

      1449 bronze badges




      1449 bronze badges

























          3 Answers
          3






          active

          oldest

          votes


















          2
















          post 'admins/all_invoices', to: 'admin#invoices'



          where admin is your controller and invoices in your action in it.






          share|improve this answer

























          • thanks for your answer, however i dont quite understand your description.

            – b.herring
            Mar 28 at 17:46











          • If the above route admins/all_invoices matches then the control would go to your controller admin and action invoices For Eg: class Admincontroller < ApplicationController def invoices # write your code here end end

            – Srinidhi Gs
            Mar 28 at 18:14



















          0
















          Something like the below snippet should do the job:



          resources :invoices, controller: "admins/invoices", only: [:create] do
          collection do
          post :create_inappointment_invoice
          end
          end


          OR



          resources :invoices, controller: "admins/invoices", only: [:create] do
          post :create_inappointment_invoice, on: :collection
          end


          This will hit the create_inappointment_invoice method in your admin/invoices controller






          share|improve this answer

























          • Thanks for your answer. However, this is taking me to the original create method still.

            – b.herring
            Mar 28 at 17:45











          • It shouldn't be! What's the url you are hitting?

            – Abhishek
            Mar 28 at 17:48











          • it's currently hitting the render new part of my other create action condition, which would suggest that it is still hitting the original create method.

            – b.herring
            Mar 29 at 8:39


















          0
















          This seemed to work:



           `post "/invoices", to: "admins/invoices#create_inappointment_invoice", as: :create_inappointment_invoice`





          share|improve this answer



























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );














            draft saved

            draft discarded
















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55403660%2fhow-to-create-a-custom-create-route-in-rails%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2
















            post 'admins/all_invoices', to: 'admin#invoices'



            where admin is your controller and invoices in your action in it.






            share|improve this answer

























            • thanks for your answer, however i dont quite understand your description.

              – b.herring
              Mar 28 at 17:46











            • If the above route admins/all_invoices matches then the control would go to your controller admin and action invoices For Eg: class Admincontroller < ApplicationController def invoices # write your code here end end

              – Srinidhi Gs
              Mar 28 at 18:14
















            2
















            post 'admins/all_invoices', to: 'admin#invoices'



            where admin is your controller and invoices in your action in it.






            share|improve this answer

























            • thanks for your answer, however i dont quite understand your description.

              – b.herring
              Mar 28 at 17:46











            • If the above route admins/all_invoices matches then the control would go to your controller admin and action invoices For Eg: class Admincontroller < ApplicationController def invoices # write your code here end end

              – Srinidhi Gs
              Mar 28 at 18:14














            2














            2










            2









            post 'admins/all_invoices', to: 'admin#invoices'



            where admin is your controller and invoices in your action in it.






            share|improve this answer













            post 'admins/all_invoices', to: 'admin#invoices'



            where admin is your controller and invoices in your action in it.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 28 at 17:33









            Srinidhi GsSrinidhi Gs

            604 bronze badges




            604 bronze badges















            • thanks for your answer, however i dont quite understand your description.

              – b.herring
              Mar 28 at 17:46











            • If the above route admins/all_invoices matches then the control would go to your controller admin and action invoices For Eg: class Admincontroller < ApplicationController def invoices # write your code here end end

              – Srinidhi Gs
              Mar 28 at 18:14


















            • thanks for your answer, however i dont quite understand your description.

              – b.herring
              Mar 28 at 17:46











            • If the above route admins/all_invoices matches then the control would go to your controller admin and action invoices For Eg: class Admincontroller < ApplicationController def invoices # write your code here end end

              – Srinidhi Gs
              Mar 28 at 18:14

















            thanks for your answer, however i dont quite understand your description.

            – b.herring
            Mar 28 at 17:46





            thanks for your answer, however i dont quite understand your description.

            – b.herring
            Mar 28 at 17:46













            If the above route admins/all_invoices matches then the control would go to your controller admin and action invoices For Eg: class Admincontroller < ApplicationController def invoices # write your code here end end

            – Srinidhi Gs
            Mar 28 at 18:14






            If the above route admins/all_invoices matches then the control would go to your controller admin and action invoices For Eg: class Admincontroller < ApplicationController def invoices # write your code here end end

            – Srinidhi Gs
            Mar 28 at 18:14














            0
















            Something like the below snippet should do the job:



            resources :invoices, controller: "admins/invoices", only: [:create] do
            collection do
            post :create_inappointment_invoice
            end
            end


            OR



            resources :invoices, controller: "admins/invoices", only: [:create] do
            post :create_inappointment_invoice, on: :collection
            end


            This will hit the create_inappointment_invoice method in your admin/invoices controller






            share|improve this answer

























            • Thanks for your answer. However, this is taking me to the original create method still.

              – b.herring
              Mar 28 at 17:45











            • It shouldn't be! What's the url you are hitting?

              – Abhishek
              Mar 28 at 17:48











            • it's currently hitting the render new part of my other create action condition, which would suggest that it is still hitting the original create method.

              – b.herring
              Mar 29 at 8:39















            0
















            Something like the below snippet should do the job:



            resources :invoices, controller: "admins/invoices", only: [:create] do
            collection do
            post :create_inappointment_invoice
            end
            end


            OR



            resources :invoices, controller: "admins/invoices", only: [:create] do
            post :create_inappointment_invoice, on: :collection
            end


            This will hit the create_inappointment_invoice method in your admin/invoices controller






            share|improve this answer

























            • Thanks for your answer. However, this is taking me to the original create method still.

              – b.herring
              Mar 28 at 17:45











            • It shouldn't be! What's the url you are hitting?

              – Abhishek
              Mar 28 at 17:48











            • it's currently hitting the render new part of my other create action condition, which would suggest that it is still hitting the original create method.

              – b.herring
              Mar 29 at 8:39













            0














            0










            0









            Something like the below snippet should do the job:



            resources :invoices, controller: "admins/invoices", only: [:create] do
            collection do
            post :create_inappointment_invoice
            end
            end


            OR



            resources :invoices, controller: "admins/invoices", only: [:create] do
            post :create_inappointment_invoice, on: :collection
            end


            This will hit the create_inappointment_invoice method in your admin/invoices controller






            share|improve this answer













            Something like the below snippet should do the job:



            resources :invoices, controller: "admins/invoices", only: [:create] do
            collection do
            post :create_inappointment_invoice
            end
            end


            OR



            resources :invoices, controller: "admins/invoices", only: [:create] do
            post :create_inappointment_invoice, on: :collection
            end


            This will hit the create_inappointment_invoice method in your admin/invoices controller







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 28 at 17:39









            AbhishekAbhishek

            1115 bronze badges




            1115 bronze badges















            • Thanks for your answer. However, this is taking me to the original create method still.

              – b.herring
              Mar 28 at 17:45











            • It shouldn't be! What's the url you are hitting?

              – Abhishek
              Mar 28 at 17:48











            • it's currently hitting the render new part of my other create action condition, which would suggest that it is still hitting the original create method.

              – b.herring
              Mar 29 at 8:39

















            • Thanks for your answer. However, this is taking me to the original create method still.

              – b.herring
              Mar 28 at 17:45











            • It shouldn't be! What's the url you are hitting?

              – Abhishek
              Mar 28 at 17:48











            • it's currently hitting the render new part of my other create action condition, which would suggest that it is still hitting the original create method.

              – b.herring
              Mar 29 at 8:39
















            Thanks for your answer. However, this is taking me to the original create method still.

            – b.herring
            Mar 28 at 17:45





            Thanks for your answer. However, this is taking me to the original create method still.

            – b.herring
            Mar 28 at 17:45













            It shouldn't be! What's the url you are hitting?

            – Abhishek
            Mar 28 at 17:48





            It shouldn't be! What's the url you are hitting?

            – Abhishek
            Mar 28 at 17:48













            it's currently hitting the render new part of my other create action condition, which would suggest that it is still hitting the original create method.

            – b.herring
            Mar 29 at 8:39





            it's currently hitting the render new part of my other create action condition, which would suggest that it is still hitting the original create method.

            – b.herring
            Mar 29 at 8:39











            0
















            This seemed to work:



             `post "/invoices", to: "admins/invoices#create_inappointment_invoice", as: :create_inappointment_invoice`





            share|improve this answer





























              0
















              This seemed to work:



               `post "/invoices", to: "admins/invoices#create_inappointment_invoice", as: :create_inappointment_invoice`





              share|improve this answer



























                0














                0










                0









                This seemed to work:



                 `post "/invoices", to: "admins/invoices#create_inappointment_invoice", as: :create_inappointment_invoice`





                share|improve this answer













                This seemed to work:



                 `post "/invoices", to: "admins/invoices#create_inappointment_invoice", as: :create_inappointment_invoice`






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 29 at 9:25









                b.herringb.herring

                1449 bronze badges




                1449 bronze badges































                    draft saved

                    draft discarded















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55403660%2fhow-to-create-a-custom-create-route-in-rails%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                    155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해