Book's Model is singular(book) and in the db is plural(books)
rails c
Item.connection
Item – see all fields and types of fields
Item.first | Item.last | Item.find(3) – find by id
<% if user_signed_in? %>
<% if @item.user_id == current_user.id %>
<%= link_to “Edit”, edit_item_path(@item) %>
<%= link_to “Delete”, item_path(@item), method: :delete, data: { confirm: “Are you sure” } %>
<% end %>
<% end %>
This README would normally document whatever steps are necessary to get the application up and running.
Things you may want to cover:
-
Ruby version
-
System dependencies
-
Configuration
-
Database creation
-
Database initialization
-
How to run the test suite
-
Services (job queues, cache servers, search engines, etc.)
-
Deployment instructions
-
...
PostgreSQL local configuration:
===========================================
sudo apt-get install postgresql
export DATABASE_URL=postgres:///$(whoami)
sudo -u postgres createuser -s
=========================================== to completely remove postgreSQL: ps -C postgres ...if shows processes, then: sudo killall postgres ps -C postgres …if there are no mo running processes, then:
sudo apt-get --purge remove postgresql* sudo rm -r /etc/postgresql/ sudo rm -r /etc/postgresql-common/ sudo rm -r /var/lib/postgresql/ udo userdel -r postgres sudo groupdel postgres
===========================================