DwellAwesome/Dwell — pull request #30 by mwdion (2014-09-14 06:39:24+00:00)
Title: Added Crud for documents

DO NOT MERGE THIS PULL REQUEST
I dont know why but after i did all this the properties index page turned white and it didnt have any errors but it wasn't showing anything either so i couldn't test if it worked.
I decided to create a CRUD for documents after all cuz created it within the property form felt wierd. So now you will click on the the property name and it will go to the show page and from the property show page you can create documents for that property. This is where paperclip needs to be implemented too, not sure how that exactly works but if you decide to not merge this pull request, when you create the migration make sure you add a column for whatever need for that. I have listed out the steps i went through to build the crud out. And i write perfect code so the views should all be good. hope this helps.

$ rails g controller documents index show new edit
$ rails g model document
go into the migration and add (columns for the database) may need to add a special column for whatever paperclip does.
t.integer :property_id
t.string :document_name
t.text :document_content
$ rake db:migrate
change the routes.rb file to say:
resources :properties do
resources :documents
end
go into the document.rb model and add a belongs_to :property relationship
go into the property.rb model and add a has_many :documents relationship
then add an add documents button in the property show page
and i wrote out all the code for the forms and the views