The only thing I could think of is the "inspect" call: :employee_id => @retrieve_case.inspect
Inspect usually returns a string of some nicely formatted, human readable representation of the object (see this, and click the "Show Source" link at the bottom to see what it returns: http://apidock.com/rails/ActiveRecord/Base/inspect) What exactly is in the @retrieve_case object? You may want to do @retrieve_case directly. The link_to should be able to stringify the object for you. - Adam On Mon, Aug 11, 2014 at 10:06 PM, Ian Baraza Brayoni <[email protected]> wrote: > Hi Cynthia/Kaufman, > > Thank you for your response. > > I have edited my gist > <https://gist.github.com/Brayoni/3102c5dab7f76b1cee7b> and it looks like, > this line: > > <%= link_to "Retrieve Case", {:controller => 'employee_indisciplines', > :action => 'show_indisciplines', :employee_id => @retrieve_case.inspect }, > { :class => 'submit_button' }, :method => 'post' %> > > is receiving a nil id after doing an inspect on it( I have shared my > development logs in the gist). > > 1234567 > > Processing EmployeeIndisciplinesController#show_indisciplines (for 127.0.0.1 > at 2014-08-12 07:27:35) [GET] > > > Parameters: {"action"=>"show_indisciplines", "employee_id"=>"nil", > "controller"=>"employee_indisciplines"} > > > as a result, the following section in my rendered html is iterating on a > nil object hence nothing is displayed. > > <% @employee_indiscipline.each do |employee | %> > > <tr class="tr-<%= cycle('odd', 'even') %>"> > > <td class="col-4"><%= employee.content %></td> > > <td class="col-7"><%= employee.created_at.strftime("%A, > %d. %B %Y, %H:%M") %></td> > > </tr> > > > <% end %> > > > > Regards, > Ian Brayoni > > > > > > > On Tue, Aug 12, 2014 at 1:52 AM, Rob Kaufman <[email protected]> wrote: > >> Ian, >> From reading your gist, I think you’re talking about the link_to on >> line 17 of “_list_indisciplines.html.erb”. You’ve got a period in your >> params >> >> employee.id is not valid (you’re setting to the id (4), not to the >> symbol itself). Also, params[:retrieve_case[]] means that you’re getting >> [] every time. >> >> <%= link_to "#{t('retrieve_case')}", {:controller => >> 'employee_indisciplines', :action => 'show_indisciplines', :employee.id => >> params[:retrieve_case[]]}, { :class => 'submit_button' }, :method => 'post' >> %> >> >> <https://gist.github.com/Brayoni/3102c5dab7f76b1cee7b> >> >> On August 11, 2014 at 8:57:34 , Cynthia Kiser ([email protected]) >> wrote: >> >> You asked about passing parameters so, in addition to the code >> generating the link, I need to see the link that it creates and how >> the routing system interprets it. >> >> Please add the following 2 pieces of information to your gist: >> 1) the rendered html from _list_indisciplines.html.erb >> 2) the section of the development log when you click that link, e.g. >> >> Processing PagesController#show (for 131.215.229.27 at 2014-03-12 >> 10:46:17) [GET] >> Parameters: {"action"=>"show", "url_parts"=>["protocols"], >> "controller"=>"pages"} >> >> >> And by the way, since you have map.feed, that should be creating a >> named route for you: feed_path. So if you want, you can use that >> instead of the hash explicitly listing controller and action. Use >> `rake routes` to see which of your routes have named route helper >> methods available. >> >> >> Quoting Ian Baraza Brayoni <[email protected]>: >> > This is what I get in my development logs which I think means I am not >> > passing any parameters to the controller 'show_indisciplines': >> > >> > ActionView::TemplateError (You have a nil object when you didn't expect >> it! >> > You might have expected an instance of Array. >> > The error occurred while evaluating nil.each) on line #36 of >> > app/views/employee_indisciplines/show_indisciplines.html.erb: >> > 33: <tr class="tr-head"> >> > 34: <td><%= t('student_case_content') %></td><td><%= >> > t('student_case_creation') %></td> >> > 35: </tr> >> > 36: <% @employee_indiscipline.each do |employee | %> >> > 37: <tr class="tr-<%= cycle('odd', 'even') %>"> >> > 38: <td class="col-4"><%= employee.content %></td> >> > 39: <td class="col-7"><%= >> > employee.created_at.strftime("%A, %d. %B %Y, %H:%M") %></td> >> > >> > >> > >> > I have shared my routes on the gist.( >> > https://gist.github.com/Brayoni/3102c5dab7f76b1cee7b) >> > >> > >> > Regards, >> > Ian Brayoni >> > >> > >> > >> > >> > >> > >> > On Mon, Aug 11, 2014 at 7:31 AM, Cynthia Kiser <[email protected]> >> wrote: >> > >> > > Quoting Ian Baraza Brayoni <[email protected]>: >> > > > I am trying to pick rails and I am having trouble trying to pass >> params >> > > > from a view to another controller method through a link_to tag. >> > > > >> > > > Here is my code < >> https://gist.github.com/Brayoni/3102c5dab7f76b1cee7b>. >> > > > >> > > > Your ideas are highly appreciated. >> > > >> > > Nothing very obviously amiss - other than being very old style >> > > Rails. What is the output? Are you not getting the HTML you expect >> > > from the link_to? Or is clicking the link not getting you where you >> > > expect to go? To help I would need to see the HTML snippet produced >> > > and the development log from when you click the link. (And I am >> > > assuming your routes are set up correctly). >> > > >> > > >> > > >> > > -- >> > > Cynthia N. Kiser >> > > [email protected] >> > > >> > > -- >> > > -- >> > > SD Ruby mailing list >> > > [email protected] >> > > http://groups.google.com/group/sdruby >> > > --- >> > > You received this message because you are subscribed to a topic in >> the >> > > Google Groups "SD Ruby" group. >> > > To unsubscribe from this topic, visit >> > > https://groups.google.com/d/topic/sdruby/Wy-Zldi3hRM/unsubscribe. >> > > To unsubscribe from this group and all its topics, send an email to >> > > [email protected]. >> > > For more options, visit https://groups.google.com/d/optout. >> > > >> > >> > -- >> > -- >> > SD Ruby mailing list >> > [email protected] >> > http://groups.google.com/group/sdruby >> > --- >> > You received this message because you are subscribed to the Google >> Groups "SD Ruby" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> an email to [email protected]. >> > For more options, visit https://groups.google.com/d/optout. >> >> -- >> Cynthia N. Kiser >> [email protected] >> >> -- >> -- >> SD Ruby mailing list >> [email protected] >> http://groups.google.com/group/sdruby >> --- >> You received this message because you are subscribed to the Google Groups >> "SD Ruby" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> >> -- >> -- >> SD Ruby mailing list >> [email protected] >> http://groups.google.com/group/sdruby >> --- >> You received this message because you are subscribed to a topic in the >> Google Groups "SD Ruby" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/sdruby/Wy-Zldi3hRM/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > -- > -- > SD Ruby mailing list > [email protected] > http://groups.google.com/group/sdruby > --- > You received this message because you are subscribed to the Google Groups > "SD Ruby" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- -- SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby --- You received this message because you are subscribed to the Google Groups "SD Ruby" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
