hi i''m very new to ROR. i must do a basic library system its my homework. i have models, user.rb (created by restful_authentication plugin) and book.rb (created by scaffolding) controllers: sessions_controller and users_controller(created by restful_authentication plugin) and books_controller(created by scaffolding) ****user.rb,sessions_controller,users controller have the same codes restful_authentication screencast and its working correct********** and i want to have a buy link at books page for example i login as ''Jack'' when i login i''m showing the books page its OK. but also i wanna see buy link and when i click it and return to the books page i wanna see the books Jack bought then logut and login again as''michael '' i wanna see books page and idont wanna see jack''s book i just wanna see michael''s book how can i do it? here is my books_controller.rb i wanna have an buy action here(user will buy a book) class BooksController < ApplicationController # GET /books # GET /books.xml def index @books = Book.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @books } end end # GET /books/1 # GET /books/1.xml def show @book = Book.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @book } end end # GET /books/new # GET /books/new.xml def new @book = Book.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @book } end end # GET /books/1/edit def edit @book = Book.find(params[:id]) end # POST /books # POST /books.xml def create @book = Book.new(params[:book]) respond_to do |format| if @book.save flash[:notice] = ''Book was successfully created.'' format.html { redirect_to(@book) } format.xml { render :xml => @book, :status => :created, :location => @book } else format.html { render :action => "new" } format.xml { render :xml => @book.errors, :status => :unprocessable_entity } end end end # PUT /books/1 # PUT /books/1.xml def update @book = Book.find(params[:id]) respond_to do |format| if @book.update_attributes(params[:book]) flash[:notice] = ''Book was successfully updated.'' format.html { redirect_to(@book) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @book.errors, :status => :unprocessable_entity } end end end # DELETE /books/1 # DELETE /books/1.xml def destroy @book = Book.find(params[:id]) @book.destroy respond_to do |format| format.html { redirect_to(books_url) } format.xml { head :ok } end end end and here is my index.html.erb i wanna see buy link and also see which book user bought <<strong>Welcome <%=current_user.login %> </strong>><%= link_to "logout", logout_path %> <h1>Listing books</h1> <table> <tr> <th>Name</th> </tr> <% @books.each do |book| %> <tr> <td><%=h book.name %></td> <td><%= link_to ''Show'', book %></td> <td><%= link_to ''Edit'', edit_book_path(book) %></td> <td><%= link_to ''Destroy'', book, :confirm => ''Are you sure?'', :method => :delete %></td> </tr> <% end %> </table> <br /> <%= link_to ''New book'', new_book_path %> can anyone help? thanks -- View this message in context: http://old.nabble.com/buy-book-from-system-user-based-tp26837112p26837112.html Sent from the RubyOnRails Users mailing list archive at Nabble.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.