On 20 Nov 2008, at 15:37, Jose vicente Ribera pellicer wrote:
> > Frederick Cheung wrote: >> On Nov 19, 11:24�pm, Jose vicente Ribera pellicer <rails-mailing- >> [EMAIL PROTECTED]> wrote: >> >>> >>> Showing tickets/exportar.html.erb where line #9 raised: >>> >>> You have a nil object when you didn't expect it! >>> The error occurred while evaluating nil.items >> >> You don't seem to be setting @cartticket anywhere. >> >> Fred > > I dont`t think so, because in ticket controller this code works fine: > > def add_to_cartticket > @cartticket = find_cartticket > ticket = Ticket.find(params[:id]) > @cartticket.add_ticket(ticket) > > end > That's irrelevant. when your expotar action is called you get a new instance of the Controller - instance variables don't persist across requests. Fred > def find_cartticket > unless session[:cartticket] # if there's no cart in the session > session[:cartticket] = Cartticket.new # add a new one > end > session[:cartticket] # return existing or new cart > end > > > thanks for the answer. Now i'm not implementing this code, only > appears > in the add_to_cartticket view one table with the fields i want to > show. > Next step if I can`t sole tehe excel problem will be print it > directly. > > > -- > 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---