i´m having something like this: <%= render(:partial => ''interview'', :object => @interviews)%> now, within the view, i´d like to pass the id-parameter to select a certain interview. like this (although this code is probably wrong): <%= render(:partial => ''interview'', :object => @interviews, :id => 1237)%> basically, i need the view to tell the controller which interview to choose. any idea how to achieve this?
Use :locals: <%= render(:partial => ''interview'', :locals => { :id => 1237 })%> Check the docs on ActionController::Base (http://api.rubyonrails.com/classes/ActionController/Base.html#M000171) On 12/1/05, patrick k <patrick-KzucmO8QuWNZ0wkgCNX5VF6hYfS7NtTn@public.gmane.org> wrote:> i´m having something like this: > > <%= render(:partial => ''interview'', :object => @interviews)%> > > now, within the view, i´d like to pass the id-parameter to select a certain > interview. > like this (although this code is probably wrong): > > <%= render(:partial => ''interview'', :object => @interviews, :id => 1237)%> > > basically, i need the view to tell the controller which interview to choose. > any idea how to achieve this? > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
how can i access the id (local) within the controller to choose the right interview?> Use :locals: > > <%= render(:partial => ''interview'', :locals => { :id => 1237 })%> > > Check the docs on ActionController::Base > (http://api.rubyonrails.com/classes/ActionController/Base.html#M000171) > > On 12/1/05, patrick k <patrick-KzucmO8QuWNZ0wkgCNX5VF6hYfS7NtTn@public.gmane.org> wrote: >> i´m having something like this: >> >> <%= render(:partial => ''interview'', :object => @interviews)%> >> >> now, within the view, i´d like to pass the id-parameter to select a certain >> interview. >> like this (although this code is probably wrong): >> >> <%= render(:partial => ''interview'', :object => @interviews, :id => 1237)%> >> >> basically, i need the view to tell the controller which interview to choose. >> any idea how to achieve this? >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
What do you mean? You retrieve the right object from your controller and pass that object to your partial. On 12/1/05, patrick k <patrick-KzucmO8QuWNZ0wkgCNX5VF6hYfS7NtTn@public.gmane.org> wrote:> how can i access the id (local) within the controller to choose the right > interview? > > > Use :locals: > > > > <%= render(:partial => ''interview'', :locals => { :id => 1237 })%> > > > > Check the docs on ActionController::Base > > (http://api.rubyonrails.com/classes/ActionController/Base.html#M000171) > > > > On 12/1/05, patrick k <patrick-KzucmO8QuWNZ0wkgCNX5VF6hYfS7NtTn@public.gmane.org> wrote: > >> i´m having something like this: > >> > >> <%= render(:partial => ''interview'', :object => @interviews)%> > >> > >> now, within the view, i´d like to pass the id-parameter to select a certain > >> interview. > >> like this (although this code is probably wrong): > >> > >> <%= render(:partial => ''interview'', :object => @interviews, :id => 1237)%> > >> > >> basically, i need the view to tell the controller which interview to choose. > >> any idea how to achieve this? > >> > >> _______________________________________________ > >> Rails mailing list > >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >> http://lists.rubyonrails.org/mailman/listinfo/rails > >> > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
as mentioned before: basically, i need the view to tell the controller which interview to choose. well, maybe that´s not possible. maybe i need components.> What do you mean? You retrieve the right object from your controller > and pass that object to your partial. > > On 12/1/05, patrick k <patrick-KzucmO8QuWNZ0wkgCNX5VF6hYfS7NtTn@public.gmane.org> wrote: >> how can i access the id (local) within the controller to choose the right >> interview? >> >>> Use :locals: >>> >>> <%= render(:partial => ''interview'', :locals => { :id => 1237 })%> >>> >>> Check the docs on ActionController::Base >>> (http://api.rubyonrails.com/classes/ActionController/Base.html#M000171) >>> >>> On 12/1/05, patrick k <patrick-KzucmO8QuWNZ0wkgCNX5VF6hYfS7NtTn@public.gmane.org> wrote: >>>> i´m having something like this: >>>> >>>> <%= render(:partial => ''interview'', :object => @interviews)%> >>>> >>>> now, within the view, i´d like to pass the id-parameter to select a certain >>>> interview. >>>> like this (although this code is probably wrong): >>>> >>>> <%= render(:partial => ''interview'', :object => @interviews, :id => 1237)%> >>>> >>>> basically, i need the view to tell the controller which interview to >>>> choose. >>>> any idea how to achieve this? >>>> >>>> _______________________________________________ >>>> Rails mailing list >>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>>> >>> _______________________________________________ >>> Rails mailing list >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
As far as I understand: First the controller is executed by rails Then the view is rendered And that''s it So there will be no way to again execute the controller after the view has been rendered. This means, no communication from view to the controller is possible. Only from controller to view. And that''s how it should be. If the decision in the view depends on some user action I would suggest using Ajax. Otherwise I would rethink your problem and solve it in the controller where logic is supposed to be. On Fri, 02 Dec 2005 11:12:13 +0100, patrick k <patrick-KzucmO8QuWNZ0wkgCNX5VF6hYfS7NtTn@public.gmane.org> wrote:> as mentioned before: > basically, i need the view to tell the controller which interview to > choose. > > well, maybe that´s not possible. maybe i need components. > > >> What do you mean? You retrieve the right object from your controller >> and pass that object to your partial. >> >> On 12/1/05, patrick k <patrick-KzucmO8QuWNZ0wkgCNX5VF6hYfS7NtTn@public.gmane.org> wrote: >>> how can i access the id (local) within the controller to choose the >>> right >>> interview? >>> >>>> Use :locals: >>>> >>>> <%= render(:partial => ''interview'', :locals => { :id => 1237 })%> >>>> >>>> Check the docs on ActionController::Base >>>> (http://api.rubyonrails.com/classes/ActionController/Base.html#M000171) >>>> >>>> On 12/1/05, patrick k <patrick-KzucmO8QuWNZ0wkgCNX5VF6hYfS7NtTn@public.gmane.org> wrote: >>>>> i´m having something like this: >>>>> >>>>> <%= render(:partial => ''interview'', :object => @interviews)%> >>>>> >>>>> now, within the view, i´d like to pass the id-parameter to select a >>>>> certain >>>>> interview. >>>>> like this (although this code is probably wrong): >>>>> >>>>> <%= render(:partial => ''interview'', :object => @interviews, :id => >>>>> 1237)%> >>>>> >>>>> basically, i need the view to tell the controller which interview to >>>>> choose. >>>>> any idea how to achieve this? >>>>> >>>>> _______________________________________________ >>>>> Rails mailing list >>>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>>>> >>>> _______________________________________________ >>>> Rails mailing list >>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>> >>> _______________________________________________ >>> Rails mailing list >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails >>> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
i already thought it might (and should) be that way. guess i have to re-think my problem. thanks for your answer.> As far as I understand: > > First the controller is executed by rails > Then the view is rendered > And that''s it > > So there will be no way to again execute the controller after > the view has been rendered. This means, no communication from view to > the controller is possible. Only from controller to view. And that''s how it > should be. If the decision in the view depends on some user action I would > suggest using Ajax. Otherwise I would rethink your problem and solve it > in the controller where logic is supposed to be. > > > On Fri, 02 Dec 2005 11:12:13 +0100, patrick k <patrick-KzucmO8QuWNZ0wkgCNX5VF6hYfS7NtTn@public.gmane.org> > wrote: > >> as mentioned before: >> basically, i need the view to tell the controller which interview to >> choose. >> >> well, maybe that´s not possible. maybe i need components. >> >> >>> What do you mean? You retrieve the right object from your controller >>> and pass that object to your partial. >>> >>> On 12/1/05, patrick k <patrick-KzucmO8QuWNZ0wkgCNX5VF6hYfS7NtTn@public.gmane.org> wrote: >>>> how can i access the id (local) within the controller to choose the >>>> right >>>> interview? >>>> >>>>> Use :locals: >>>>> >>>>> <%= render(:partial => ''interview'', :locals => { :id => 1237 })%> >>>>> >>>>> Check the docs on ActionController::Base >>>>> (http://api.rubyonrails.com/classes/ActionController/Base.html#M000171) >>>>> >>>>> On 12/1/05, patrick k <patrick-KzucmO8QuWNZ0wkgCNX5VF6hYfS7NtTn@public.gmane.org> wrote: >>>>>> i´m having something like this: >>>>>> >>>>>> <%= render(:partial => ''interview'', :object => @interviews)%> >>>>>> >>>>>> now, within the view, i´d like to pass the id-parameter to select a >>>>>> certain >>>>>> interview. >>>>>> like this (although this code is probably wrong): >>>>>> >>>>>> <%= render(:partial => ''interview'', :object => @interviews, :id => >>>>>> 1237)%> >>>>>> >>>>>> basically, i need the view to tell the controller which interview to >>>>>> choose. >>>>>> any idea how to achieve this? >>>>>> >>>>>> _______________________________________________ >>>>>> Rails mailing list >>>>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>>>>> >>>>> _______________________________________________ >>>>> Rails mailing list >>>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>>> >>>> _______________________________________________ >>>> Rails mailing list >>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>>> >>> _______________________________________________ >>> Rails mailing list >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails