Witam wyczerpaly mi sie pomysly co moze byc nie tak
pojawia mi sie komunikat:
a teraz troche kodu:
edytuj.html.erb:
<h1>Educja Zgłoszenia <%= @ticket.tytul %></h1>
<%= link_to("Wróć", {:action => 'index'}, :class => 'btn btn-mini btn-warning', :style => 'margin-bottom:10px;')%>
<%= form_for(:ticket, :url => {:action => 'aktualizuj', :id => @ticket.id}) do |pole| %>
<table class="table table-hover">
<tr class="info"><th style="text-align:center;"><%= pole.label(:tytul) %></th></tr>
<tr class="warning"><td><%= pole.text_field(:tytul) %></td></tr>
<tr class="info"><th style="text-align:center;"><%= pole.label(:tresc) %></th></tr>
<tr class="warning"><td><%= pole.text_area(:tresc) %></td></tr>
<tr class="info"><th style="text-align:center;"><%= pole.label(:zglaszajacy, "Imie i nazwisko zgłaszającego") %></th><tr>
<tr class="warning"><th><%= pole.text_field(:zglaszajacy) %></th></tr>
<tr class="info"><th style="text-align:center;"><%= pole.label(:priorytet) %></th></tr>
<tr class="warning"><td><%= pole.select(:priorytet, @priorytet ) %></td></tr>
<tr class="info"><th style="text-align:center;"><%= pole.label(:status) %></th></tr>
<tr class="warning"><td style="text-align:center;"><%= pole.check_box(:status) %></td></tr>
<tr class="info"><th style="text-align:center;"><%= pole.label(:komentarz) %></th></tr>
<tr class="warning"><td style="width:100%;"><%= pole.text_area(:komentarz) %></td></tr>
</table>
<div>
<%= submit_tag("Aktualizuj", :class => 'btn btn-mini btn-primary', :style => 'display:block; margin:0 auto; width:100px;')%>
</div>
<%end%>
controller:
def edytuj
@ticket = Ticket.find(params[:id])
@priorytet = ['niski', 'sredni', 'wysoki']
end
def aktualizuj
@ticket = Ticket.find(params[:id])
if @ticket = Ticket.update_attributes(parametr1)
redirect_to(:action => 'pokaz', :id => @ticket.id)
else
render('edycja')
end
end
def parametr1
params.require(:ticket).permit(:tytul, :tresc, :zglaszajacy, :priorytet, :komentarz, :status)
end
Już nie mam pomyslu co moze byc nie tak… bardzo prosze o pomoc