Is it a good rails agile code?

I have two classes: User and Delivery.

class Ruser < ActiveRecord::Base
has_many :deliveries, :dependent => :destroy

class Delivery < ActiveRecord::Base
belongs_to :ruser

In the User show action I have put:

<%= render :partial => ‘deliveries/form’ %>

So that showing the user I can create a delivery for it.
Delivery form is:

<%= form_for(@delivery) do |f| %>
<% if @delivery.errors.any? %>

<%= pluralize(@delivery.errors.count, "error") %> prohibited this delivery from being saved:

 <ul>
 <% @delivery.errors.full_messages.each do |msg| %>
   <li><%= msg %></li>
 <% end %>
 </ul>
<% end %>
<%= f.label :delivered_at %>: <%= l Date.today %>

<%= f.label :notes%>
<%= f.text_area :notes %>

<%= f.hidden_field :ruser_id, :value => @ruser.id %>

<%= f.submit %>
<% end %>

Is it a good code or there is a better mode to create a delivery for one
user?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs