I want to be able to change one attribute of a link_to to be what is the
current selection of the collection_select. And needless to say I can''t
quite figure it out.
app/views/tasks/show.html.erb
Who would you like to assign this task to?<br />
<%= link_to ''Myself'', :controller =>
''task_queues'', :task_id => @task.id,
:action => ''assign_to_me'' %> |
Assign To:
<%= collection_select("assign", "user_id", @users, :id,
:full_name )%>
<%= link_to ''Assign'', :controller
=>''task_queues'', :task_id => @task.id,
:user_id => ## Current Selection of the collection_select ##, :action =>
''assign_to_other'' %>
This action brings it across to another controller/model where I write the
results to the task_queues database.
Any insight or assistance in this would be greatly apprecaited.
Thanks,
Brian
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/Oq5nxBRZV0oJ.
For more options, visit https://groups.google.com/groups/opt_out.
Shameless bump ... can anyone help on this? On Thursday, September 13, 2012 9:32:34 AM UTC-5, Brian Ekmark wrote:> I want to be able to change one attribute of a link_to to be what is the > current selection of the collection_select. And needless to say I can''t > quite figure it out. > > app/views/tasks/show.html.erb > > Who would you like to assign this task to?<br /> > <%= link_to ''Myself'', :controller => ''task_queues'', :task_id => @task.id, > :action => ''assign_to_me'' %> | > Assign To: > <%= collection_select("assign", "user_id", @users, :id, :full_name )%> > <%= link_to ''Assign'', :controller =>''task_queues'', :task_id => @task.id, > :user_id => ## Current Selection of the collection_select ##, :action => > ''assign_to_other'' %> > > This action brings it across to another controller/model where I write the > results to the task_queues database. > > Any insight or assistance in this would be greatly apprecaited. > > Thanks, > > Brian >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/k8K_pbExS-QJ. For more options, visit https://groups.google.com/groups/opt_out.
Hey Brian,
currently im a bit tired so im not able to write this code for you.
however, here is what i would do:
1. app/views/tasks/show.html.erb should be to view the task given by the id
(tasks/1). so you shouldn''t do any edit on that article on the show
page
itself.
this leads to
2. you should use a form for that. make a function task_assign in the task
and pass the user you want to assign the task to in the params hash.
like
<%= form_for(@task) do |f| %>
<%= f.collection_select("assign", "user_id", @users, :id,
:full_name )%> //
this line is copypasta from you, didnt look if right
<%= f.submit %>
<% end %>
you could, i say could, do the form on the show page as well, maybe need to
specify controller and action then but that wont be a problem i guess.
greetings,
Crispin
Am Donnerstag, 13. September 2012 16:32:34 UTC+2 schrieb Brian
Ekmark:>
> I want to be able to change one attribute of a link_to to be what is the
> current selection of the collection_select. And needless to say I
can''t
> quite figure it out.
>
> app/views/tasks/show.html.erb
>
> Who would you like to assign this task to?<br />
> <%= link_to ''Myself'', :controller =>
''task_queues'', :task_id => @task.id,
> :action => ''assign_to_me'' %> |
> Assign To:
> <%= collection_select("assign", "user_id", @users,
:id, :full_name )%>
> <%= link_to ''Assign'', :controller
=>''task_queues'', :task_id => @task.id,
> :user_id => ## Current Selection of the collection_select ##, :action
=>
> ''assign_to_other'' %>
>
> This action brings it across to another controller/model where I write the
> results to the task_queues database.
>
> Any insight or assistance in this would be greatly apprecaited.
>
> Thanks,
>
> Brian
>
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/g_-mUJSUZdAJ.
For more options, visit https://groups.google.com/groups/opt_out.
On Tue, Sep 18, 2012 at 7:16 AM, Brian Ekmark <brian.ekmark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> Shameless bump ... can anyone help on this? > > On Thursday, September 13, 2012 9:32:34 AM UTC-5, Brian Ekmark wrote: > >> I want to be able to change one attribute of a link_to to be what is the >> current selection of the collection_select. And needless to say I can''t >> quite figure it out. >> >> app/views/tasks/show.html.erb >> >> Who would you like to assign this task to?<br /> >> <%= link_to ''Myself'', :controller => ''task_queues'', :task_id => @task.id, >> :action => ''assign_to_me'' %> | >> Assign To: >> <%= collection_select("assign", "user_id", @users, :id, :full_name )%> >> <%= link_to ''Assign'', :controller =>''task_queues'', :task_id => @task.id, >> :user_id => ## Current Selection of the collection_select ##, :action => >> ''assign_to_other'' %> >> >> This action brings it across to another controller/model where I write >> the results to the task_queues database. >> >> Any insight or assistance in this would be greatly apprecaited. >> >You need to use javascript. In jquery that would be $(''#assign_user_id'').change(function() { $(this).next().attr(''href'', ''/task_queues/#{@task.id}/assign_to_other/'' + $(''#assign_user_id :selected'').val() I''m not sure how your routes is setup so I''m not sure if I got your url right.>> Thanks, >> >> Brian >> > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/k8K_pbExS-QJ. > > For more options, visit https://groups.google.com/groups/opt_out. > > >-- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.