I am running through this tutorial:
http://www.tutorialspoint.com/ruby-on-rails/rails-views.htm
I have created the forms and the input form is working to create books
and they are in the database but when I go to list.rhml it keeps telling
me there are no books. Here is the code:
<% if @books.blank? %>
There are not any books currently in the system.
<% else %>These are the current books in our system
-
<% @books.each do |c| %>
- <%= link_to c.title, {:action => 'show', :id => c.id} -%> <% end %>
Here is list in the controller:
def list
@books = Book.find(:all)
end
Here is the model
class Book < ActiveRecord::Base
belongs_to :subject
validates_presence_of :title
validates_numericality_of :price, :message=>“Error Message”
end
If you can give me any insight that would be great!
Thanks
Chris