help...how do i get the "projects_path" from controller?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

help...how do i get the "projects_path" from controller?

tommaso159
hi, i have a generic _index partial, but i am struggling with constrcuting the 

(link_to "show", ......(rec.id))


how can i get that filled in? i have tried via url_for (controller & action), but it always says: arguments passed to url_for can't be handled

please help

thx

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMcwBzUv9EYzHCEoN%2BZXDb4pEWt%2BU%2BKpbtO3Es375-xpug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: help...how do i get the "projects_path" from controller?

Walter Lee Davis
The projects path isn't coming from the controller, it's coming from the routes file. Do you have any references in your routes.rb file that mention projects?

Walter

> On May 21, 2019, at 2:46 PM, tom <[hidden email]> wrote:
>
> hi, i have a generic _index partial, but i am struggling with constrcuting the
>
> (link_to "show", ......(rec.id))
>
>
> how can i get that filled in? i have tried via url_for (controller & action), but it always says: arguments passed to url_for can't be handled
>
> please help
>
> thx
>
>
> --
> 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 [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMcwBzUv9EYzHCEoN%2BZXDb4pEWt%2BU%2BKpbtO3Es375-xpug%40mail.gmail.com.
> 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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/AAAFA33B-6F38-44A6-87D2-E2CF7FBEE5D5%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: help...how do i get the "projects_path" from controller?

tommaso159
yes i do:
  scope :pm do
    get '/', :to => 'projects#dashboard',   :as=>'pm_dashboard'
    resources :project_resource_groups #, :path=>'tasks'
    resources :project_programs
    resources :projects
end


but again, the _index view partial is used in a lot index actions, so i dont know how to "pick" the right 'path' while creating the html table...


thx


On Tue, May 21, 2019 at 2:49 PM Walter Lee Davis <[hidden email]> wrote:
The projects path isn't coming from the controller, it's coming from the routes file. Do you have any references in your routes.rb file that mention projects?

Walter

> On May 21, 2019, at 2:46 PM, tom <[hidden email]> wrote:
>
> hi, i have a generic _index partial, but i am struggling with constrcuting the
>
> (link_to "show", ......(rec.id))
>
>
> how can i get that filled in? i have tried via url_for (controller & action), but it always says: arguments passed to url_for can't be handled
>
> please help
>
> thx
>
>
> --
> 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 [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMcwBzUv9EYzHCEoN%2BZXDb4pEWt%2BU%2BKpbtO3Es375-xpug%40mail.gmail.com.
> 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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/AAAFA33B-6F38-44A6-87D2-E2CF7FBEE5D5%40wdstudio.com.
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMedP5BfQtZgsrAGcNPjhVTbfc28OZXG2yEtQgqNS1dXVQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: help...how do i get the "projects_path" from controller?

Walter Lee Davis
You could use

link_to 'Index', url_for(controller: controller_name, action: :index)

instead. That would be agnostic of whichever controller was rendering that _index.html.erb partial.

Walter

> On May 21, 2019, at 2:59 PM, tom <[hidden email]> wrote:
>
> yes i do:
>   scope :pm do
>     get '/', :to => 'projects#dashboard',   :as=>'pm_dashboard'
>     resources :project_resource_groups #, :path=>'tasks'
>     resources :project_programs
>     resources :projects
> end
>
>
> but again, the _index view partial is used in a lot index actions, so i dont know how to "pick" the right 'path' while creating the html table...
>
>
> thx
>
>
> On Tue, May 21, 2019 at 2:49 PM Walter Lee Davis <[hidden email]> wrote:
> The projects path isn't coming from the controller, it's coming from the routes file. Do you have any references in your routes.rb file that mention projects?
>
> Walter
>
> > On May 21, 2019, at 2:46 PM, tom <[hidden email]> wrote:
> >
> > hi, i have a generic _index partial, but i am struggling with constrcuting the
> >
> > (link_to "show", ......(rec.id))
> >
> >
> > how can i get that filled in? i have tried via url_for (controller & action), but it always says: arguments passed to url_for can't be handled
> >
> > please help
> >
> > thx
> >
> >
> > --
> > 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 [hidden email].
> > To post to this group, send email to [hidden email].
> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMcwBzUv9EYzHCEoN%2BZXDb4pEWt%2BU%2BKpbtO3Es375-xpug%40mail.gmail.com.
> > 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 [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/AAAFA33B-6F38-44A6-87D2-E2CF7FBEE5D5%40wdstudio.com.
> 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 [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMedP5BfQtZgsrAGcNPjhVTbfc28OZXG2yEtQgqNS1dXVQ%40mail.gmail.com.
> 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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/256470F3-466D-4D69-9DFA-871582AF4F2C%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: help...how do i get the "projects_path" from controller?

Ariel Juodziukynas
You can pass the object to the link_to if you want to use the show url:

link_to 'Show', record

Rails will infere the show action with the proper controller and id from the object's class

El mar., 21 may. 2019 a las 16:03, Walter Lee Davis (<[hidden email]>) escribió:
You could use

link_to 'Index', url_for(controller: controller_name, action: :index)

instead. That would be agnostic of whichever controller was rendering that _index.html.erb partial.

Walter

> On May 21, 2019, at 2:59 PM, tom <[hidden email]> wrote:
>
> yes i do:
>   scope :pm do
>     get '/', :to => 'projects#dashboard',   :as=>'pm_dashboard'
>     resources :project_resource_groups #, :path=>'tasks'
>     resources :project_programs
>     resources :projects
> end
>
>
> but again, the _index view partial is used in a lot index actions, so i dont know how to "pick" the right 'path' while creating the html table...
>
>
> thx
>
>
> On Tue, May 21, 2019 at 2:49 PM Walter Lee Davis <[hidden email]> wrote:
> The projects path isn't coming from the controller, it's coming from the routes file. Do you have any references in your routes.rb file that mention projects?
>
> Walter
>
> > On May 21, 2019, at 2:46 PM, tom <[hidden email]> wrote:
> >
> > hi, i have a generic _index partial, but i am struggling with constrcuting the
> >
> > (link_to "show", ......(rec.id))
> >
> >
> > how can i get that filled in? i have tried via url_for (controller & action), but it always says: arguments passed to url_for can't be handled
> >
> > please help
> >
> > thx
> >
> >
> > --
> > 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 [hidden email].
> > To post to this group, send email to [hidden email].
> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMcwBzUv9EYzHCEoN%2BZXDb4pEWt%2BU%2BKpbtO3Es375-xpug%40mail.gmail.com.
> > 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 [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/AAAFA33B-6F38-44A6-87D2-E2CF7FBEE5D5%40wdstudio.com.
> 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 [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMedP5BfQtZgsrAGcNPjhVTbfc28OZXG2yEtQgqNS1dXVQ%40mail.gmail.com.
> 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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/256470F3-466D-4D69-9DFA-871582AF4F2C%40wdstudio.com.
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAPS3bcBVskd36z25XkH4s9Bk_uZL3F8%2B4UrwAoC6qzvQMKmMpw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: help...how do i get the "projects_path" from controller?

Walter Lee Davis
Oh, duh. I didn't read what you were asking. Please ignore my answer. Ariel has the right answer here.

Walter

> On May 21, 2019, at 3:06 PM, Ariel Juodziukynas <[hidden email]> wrote:
>
> You can pass the object to the link_to if you want to use the show url:
>
> link_to 'Show', record
>
> Rails will infere the show action with the proper controller and id from the object's class
>
> El mar., 21 may. 2019 a las 16:03, Walter Lee Davis (<[hidden email]>) escribió:
> You could use
>
> link_to 'Index', url_for(controller: controller_name, action: :index)
>
> instead. That would be agnostic of whichever controller was rendering that _index.html.erb partial.
>
> Walter
>
> > On May 21, 2019, at 2:59 PM, tom <[hidden email]> wrote:
> >
> > yes i do:
> >   scope :pm do
> >     get '/', :to => 'projects#dashboard',   :as=>'pm_dashboard'
> >     resources :project_resource_groups #, :path=>'tasks'
> >     resources :project_programs
> >     resources :projects
> > end
> >
> >
> > but again, the _index view partial is used in a lot index actions, so i dont know how to "pick" the right 'path' while creating the html table...
> >
> >
> > thx
> >
> >
> > On Tue, May 21, 2019 at 2:49 PM Walter Lee Davis <[hidden email]> wrote:
> > The projects path isn't coming from the controller, it's coming from the routes file. Do you have any references in your routes.rb file that mention projects?
> >
> > Walter
> >
> > > On May 21, 2019, at 2:46 PM, tom <[hidden email]> wrote:
> > >
> > > hi, i have a generic _index partial, but i am struggling with constrcuting the
> > >
> > > (link_to "show", ......(rec.id))
> > >
> > >
> > > how can i get that filled in? i have tried via url_for (controller & action), but it always says: arguments passed to url_for can't be handled
> > >
> > > please help
> > >
> > > thx
> > >
> > >
> > > --
> > > 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 [hidden email].
> > > To post to this group, send email to [hidden email].
> > > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMcwBzUv9EYzHCEoN%2BZXDb4pEWt%2BU%2BKpbtO3Es375-xpug%40mail.gmail.com.
> > > 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 [hidden email].
> > To post to this group, send email to [hidden email].
> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/AAAFA33B-6F38-44A6-87D2-E2CF7FBEE5D5%40wdstudio.com.
> > 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 [hidden email].
> > To post to this group, send email to [hidden email].
> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMedP5BfQtZgsrAGcNPjhVTbfc28OZXG2yEtQgqNS1dXVQ%40mail.gmail.com.
> > 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 [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/256470F3-466D-4D69-9DFA-871582AF4F2C%40wdstudio.com.
> 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 [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAPS3bcBVskd36z25XkH4s9Bk_uZL3F8%2B4UrwAoC6qzvQMKmMpw%40mail.gmail.com.
> 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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/12527C3C-C85E-48F1-868F-4AB7B35FC129%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: help...how do i get the "projects_path" from controller?

tommaso159
In reply to this post by Ariel Juodziukynas
thanks to all, BUT:

 <%= link_to "X", project_path(rec.id) %>
--> harcoding works

 <%= link_to "X", url_for([rec, rec.id ]) %>
--> arguments passed to url_for can't be handled. Please require routes or provide your own implementation

  <%= link_to "X2", :url =>   url_for(action: 'show', controller: "pm/projects", :id=>rec.id )  %>
--> arguments passed to url_for can't be handled. Please require routes or provide your own implementation

<%= link_to "X3", url_for(action: 'show', controller: "pm/projects", :id=>rec.id ) %> 
--> arguments passed to url_for can't be handled. Please require routes or provide your own implementation

i am loosing it....

On Tue, May 21, 2019 at 3:07 PM Ariel Juodziukynas <[hidden email]> wrote:
You can pass the object to the link_to if you want to use the show url:

link_to 'Show', record

Rails will infere the show action with the proper controller and id from the object's class

El mar., 21 may. 2019 a las 16:03, Walter Lee Davis (<[hidden email]>) escribió:
You could use

link_to 'Index', url_for(controller: controller_name, action: :index)

instead. That would be agnostic of whichever controller was rendering that _index.html.erb partial.

Walter

> On May 21, 2019, at 2:59 PM, tom <[hidden email]> wrote:
>
> yes i do:
>   scope :pm do
>     get '/', :to => 'projects#dashboard',   :as=>'pm_dashboard'
>     resources :project_resource_groups #, :path=>'tasks'
>     resources :project_programs
>     resources :projects
> end
>
>
> but again, the _index view partial is used in a lot index actions, so i dont know how to "pick" the right 'path' while creating the html table...
>
>
> thx
>
>
> On Tue, May 21, 2019 at 2:49 PM Walter Lee Davis <[hidden email]> wrote:
> The projects path isn't coming from the controller, it's coming from the routes file. Do you have any references in your routes.rb file that mention projects?
>
> Walter
>
> > On May 21, 2019, at 2:46 PM, tom <[hidden email]> wrote:
> >
> > hi, i have a generic _index partial, but i am struggling with constrcuting the
> >
> > (link_to "show", ......(rec.id))
> >
> >
> > how can i get that filled in? i have tried via url_for (controller & action), but it always says: arguments passed to url_for can't be handled
> >
> > please help
> >
> > thx
> >
> >
> > --
> > 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 [hidden email].
> > To post to this group, send email to [hidden email].
> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMcwBzUv9EYzHCEoN%2BZXDb4pEWt%2BU%2BKpbtO3Es375-xpug%40mail.gmail.com.
> > 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 [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/AAAFA33B-6F38-44A6-87D2-E2CF7FBEE5D5%40wdstudio.com.
> 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 [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMedP5BfQtZgsrAGcNPjhVTbfc28OZXG2yEtQgqNS1dXVQ%40mail.gmail.com.
> 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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/256470F3-466D-4D69-9DFA-871582AF4F2C%40wdstudio.com.
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAPS3bcBVskd36z25XkH4s9Bk_uZL3F8%2B4UrwAoC6qzvQMKmMpw%40mail.gmail.com.
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMeMAbHzyQpdx_sj_HV3_NDOHZHwTg8mre%3Dnx7AUjN%2BDFw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: help...how do i get the "projects_path" from controller?

tommaso159
In reply to this post by Walter Lee Davis
Started GET "/pm/projects" for 10.0.1.10 at 2019-05-21 15:12:09 -0400
Cannot render console from 10.0.1.10! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Processing by ProjectsController#index as HTML
  User Load (0.6ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1  ORDER BY "users"."id" ASC LIMIT 1  [["id", 1]]
"ProjectsController::index ================================================="


browser:
<%= link_to "show1", rec %>
--> arguments passed to url_for can't be handled. Please require routes or provide your own implementation





On Tue, May 21, 2019 at 3:11 PM Walter Lee Davis <[hidden email]> wrote:
Oh, duh. I didn't read what you were asking. Please ignore my answer. Ariel has the right answer here.

Walter

> On May 21, 2019, at 3:06 PM, Ariel Juodziukynas <[hidden email]> wrote:
>
> You can pass the object to the link_to if you want to use the show url:
>
> link_to 'Show', record
>
> Rails will infere the show action with the proper controller and id from the object's class
>
> El mar., 21 may. 2019 a las 16:03, Walter Lee Davis (<[hidden email]>) escribió:
> You could use
>
> link_to 'Index', url_for(controller: controller_name, action: :index)
>
> instead. That would be agnostic of whichever controller was rendering that _index.html.erb partial.
>
> Walter
>
> > On May 21, 2019, at 2:59 PM, tom <[hidden email]> wrote:
> >
> > yes i do:
> >   scope :pm do
> >     get '/', :to => 'projects#dashboard',   :as=>'pm_dashboard'
> >     resources :project_resource_groups #, :path=>'tasks'
> >     resources :project_programs
> >     resources :projects
> > end
> >
> >
> > but again, the _index view partial is used in a lot index actions, so i dont know how to "pick" the right 'path' while creating the html table...
> >
> >
> > thx
> >
> >
> > On Tue, May 21, 2019 at 2:49 PM Walter Lee Davis <[hidden email]> wrote:
> > The projects path isn't coming from the controller, it's coming from the routes file. Do you have any references in your routes.rb file that mention projects?
> >
> > Walter
> >
> > > On May 21, 2019, at 2:46 PM, tom <[hidden email]> wrote:
> > >
> > > hi, i have a generic _index partial, but i am struggling with constrcuting the
> > >
> > > (link_to "show", ......(rec.id))
> > >
> > >
> > > how can i get that filled in? i have tried via url_for (controller & action), but it always says: arguments passed to url_for can't be handled
> > >
> > > please help
> > >
> > > thx
> > >
> > >
> > > --
> > > 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 [hidden email].
> > > To post to this group, send email to [hidden email].
> > > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMcwBzUv9EYzHCEoN%2BZXDb4pEWt%2BU%2BKpbtO3Es375-xpug%40mail.gmail.com.
> > > 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 [hidden email].
> > To post to this group, send email to [hidden email].
> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/AAAFA33B-6F38-44A6-87D2-E2CF7FBEE5D5%40wdstudio.com.
> > 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 [hidden email].
> > To post to this group, send email to [hidden email].
> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMedP5BfQtZgsrAGcNPjhVTbfc28OZXG2yEtQgqNS1dXVQ%40mail.gmail.com.
> > 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 [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/256470F3-466D-4D69-9DFA-871582AF4F2C%40wdstudio.com.
> 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 [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAPS3bcBVskd36z25XkH4s9Bk_uZL3F8%2B4UrwAoC6qzvQMKmMpw%40mail.gmail.com.
> 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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/12527C3C-C85E-48F1-868F-4AB7B35FC129%40wdstudio.com.
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMfjzasizzQx1zmT%3D_n-mpqpojY-5ZuwTRykCzi81HU2cw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: help...how do i get the "projects_path" from controller?

Ariel Juodziukynas
where are you calling that link_to helper? on a view? on a helper? sounds like you are not on the right context to properly use url_for helper (that's why it complains that you have to require routes or provide your implementation for it)

El mar., 21 may. 2019 a las 16:15, tom (<[hidden email]>) escribió:
Started GET "/pm/projects" for 10.0.1.10 at 2019-05-21 15:12:09 -0400
Cannot render console from 10.0.1.10! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Processing by ProjectsController#index as HTML
  User Load (0.6ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1  ORDER BY "users"."id" ASC LIMIT 1  [["id", 1]]
"ProjectsController::index ================================================="


browser:
<%= link_to "show1", rec %>
--> arguments passed to url_for can't be handled. Please require routes or provide your own implementation





On Tue, May 21, 2019 at 3:11 PM Walter Lee Davis <[hidden email]> wrote:
Oh, duh. I didn't read what you were asking. Please ignore my answer. Ariel has the right answer here.

Walter

> On May 21, 2019, at 3:06 PM, Ariel Juodziukynas <[hidden email]> wrote:
>
> You can pass the object to the link_to if you want to use the show url:
>
> link_to 'Show', record
>
> Rails will infere the show action with the proper controller and id from the object's class
>
> El mar., 21 may. 2019 a las 16:03, Walter Lee Davis (<[hidden email]>) escribió:
> You could use
>
> link_to 'Index', url_for(controller: controller_name, action: :index)
>
> instead. That would be agnostic of whichever controller was rendering that _index.html.erb partial.
>
> Walter
>
> > On May 21, 2019, at 2:59 PM, tom <[hidden email]> wrote:
> >
> > yes i do:
> >   scope :pm do
> >     get '/', :to => 'projects#dashboard',   :as=>'pm_dashboard'
> >     resources :project_resource_groups #, :path=>'tasks'
> >     resources :project_programs
> >     resources :projects
> > end
> >
> >
> > but again, the _index view partial is used in a lot index actions, so i dont know how to "pick" the right 'path' while creating the html table...
> >
> >
> > thx
> >
> >
> > On Tue, May 21, 2019 at 2:49 PM Walter Lee Davis <[hidden email]> wrote:
> > The projects path isn't coming from the controller, it's coming from the routes file. Do you have any references in your routes.rb file that mention projects?
> >
> > Walter
> >
> > > On May 21, 2019, at 2:46 PM, tom <[hidden email]> wrote:
> > >
> > > hi, i have a generic _index partial, but i am struggling with constrcuting the
> > >
> > > (link_to "show", ......(rec.id))
> > >
> > >
> > > how can i get that filled in? i have tried via url_for (controller & action), but it always says: arguments passed to url_for can't be handled
> > >
> > > please help
> > >
> > > thx
> > >
> > >
> > > --
> > > 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 [hidden email].
> > > To post to this group, send email to [hidden email].
> > > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMcwBzUv9EYzHCEoN%2BZXDb4pEWt%2BU%2BKpbtO3Es375-xpug%40mail.gmail.com.
> > > 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 [hidden email].
> > To post to this group, send email to [hidden email].
> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/AAAFA33B-6F38-44A6-87D2-E2CF7FBEE5D5%40wdstudio.com.
> > 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 [hidden email].
> > To post to this group, send email to [hidden email].
> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMedP5BfQtZgsrAGcNPjhVTbfc28OZXG2yEtQgqNS1dXVQ%40mail.gmail.com.
> > 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 [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/256470F3-466D-4D69-9DFA-871582AF4F2C%40wdstudio.com.
> 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 [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAPS3bcBVskd36z25XkH4s9Bk_uZL3F8%2B4UrwAoC6qzvQMKmMpw%40mail.gmail.com.
> 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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/12527C3C-C85E-48F1-868F-4AB7B35FC129%40wdstudio.com.
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMfjzasizzQx1zmT%3D_n-mpqpojY-5ZuwTRykCzi81HU2cw%40mail.gmail.com.
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAPS3bcDPK%3DQ038E-faerj89LY4fgNC_OoYW_MoVYAdYvH_fbxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.