-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzsetup_commands
67 lines (49 loc) · 1.8 KB
/
zsetup_commands
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
open postgresql
$ rails new photo_sharing_app -d postgresql –T
confirm:
config/application.rb does not contain: config.action_controller.permit_all_parameters = true
app/controllers/application_controller.rb: includes protect_from_forgery with: :exception [protect against csrf]
*config/database.yml:
development:
adapter: postgresql
database: rails_photo_sharing_app_development
test:
adapter: postgresql
database: rails_photo_sharing_app_test
open postgres
$ rake db:create
update gemfile
$ bundle install
$ rails generate rspec:install
*Bootstrap
stylesheets/application.css: change to css.scss (for sass). Add:
@import "bootstrap-sprockets";
@import "bootstrap";
[@import "@import "styling.scss";[or any other scss files for styling]";]
javascripts/application.js: Add:
//= require bootstrap-sprockets
Flash Messages:
views/layouts/application.html.erb:
<% if flash[:notice] %>
<div class="alert alert-info">
<%= flash[:notice] %>
</div>
<% end %>
<% if flash[:alert] %>
<div class="alert alert-danger">
<%= flash[:alert] %>
</div>
<% end %>
*Migration
$ rails generate migration create_users
$ rails generate migration create_photos
$ rails generate migration AddImageToPhotos image:attachment
$ rails generate migration create_tags
$ rails generate migration AddIdsToTags ids:integer
$ rails generate migration create_photos_tags
$ rails generate migration create_favorites
[Note: also create sessions contoller for logins--no migration or model required there]
[examples of rollback, remove, and add:
$ rake db:rollback VERSION=20150121004709 (delete file first; also can use STEP = 2)
$ rails generate migration RemoveRecipie_IdFromRecipesTags recipie_id:integer
$ rails generate migration AddImageToPhotos image:attachment