Permalink
Browse files

add drop down list for lent to user

  • Loading branch information...
1 parent bdf1274 commit 8e3aaf64fcfb341ceddd6147712f1d79a12920d5 @FuriKuri committed Nov 8, 2012
Showing with 6 additions and 1 deletion.
  1. +3 −1 app/controllers/books_controller.rb
  2. +3 −0 app/views/books/_form.html.erb
@@ -43,7 +43,9 @@ def edit
def create
@book = Book.new(params[:book])
@book.owner_id = session[:user_id]
- @book.lent_to_user_id = session[:user_id]
+ unless @book.lent_to_user_id
+ @book.lent_to_user_id = session[:user_id]
+ end
respond_to do |format|
if @book.save
@@ -23,6 +23,9 @@
<%= f.label :image_url %><br />
<%= f.text_field :image_url %>
</div>
+ <div class="field">
+ <%= collection_select(:book, :lent_to_user_id, User.all, :id, :name, :prompt => true) %>
+ </div>
<div class="actions">
<%= f.submit %>
</div>

0 comments on commit 8e3aaf6

Please sign in to comment.