I am working on a web app that attaches to a MySQL database. I can add users through the admin_controller just fine without "before_filter :authorize" I need that statement obviously. When I try to login with my admin password I get this NoMethodError in Login#index Showing app/views/login/index.rhtml where line #9 raised: You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occured while evaluating nil.each Extracted source (around line #9): 6: <th><%= column.human_name %></th> 7: <% end %> 8: </tr> 9: <% for account in @accounts %> 10: <tr> 11: <% for column in Account.content_columns %> 12: <td><%=h account.send(column.name) %></td> RAILS_ROOT: ./script/../config/.. Application Trace | Framework Trace | Full Trace #{RAILS_ROOT}/app/views/login/index.rhtml:9:in `_run_rhtml_login_index'' -e:4:in `load'' -e:4 Any suggestions would be appreciated. -- Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> Any suggestions would be appreciated.Either there are no @accounts being returned or haven''t setup the @accounts instance variable in your controller. Try putting a condition before the loop that checks to see if there are any accounts in @accounts like: <%if @accounts.nil?%> no accounts or account instance var <%else%> I have this many accounts: <%=@accounts.length%> #your stuff here <%end%> -- Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hello I have a select tag in the filename.rhtml How to get the selected option of select tag in the controller -- Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
David Coleman wrote:>> Any suggestions would be appreciated. > > Either there are no @accounts being returned or haven''t setup the > @accounts instance variable in your controller. > > Try putting a condition before the loop that checks to see if there are > any accounts in @accounts like: > > <%if @accounts.nil?%> > no accounts or account instance var > <%else%> > I have this many accounts: <%=@accounts.length%> > #your stuff here > <%end%>Thanks a lot David! I was able to get this going. Thank you. -- Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---