Last active
March 13, 2016 11:06
-
-
Save Devalo/8c17d7dc92800d3ba828 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #In my schema | |
| t.string "picture", default: [], array: true | |
| #In my projects_controller.rb | |
| def index | |
| @projects = Project.friendly.all | |
| end | |
| def show | |
| @project = Project.friendly.find(params[:id]) | |
| end | |
| def project_params | |
| params.require(:project).permit(:content, {picture: []}, :project_name, :project_headline, :project_text) | |
| end | |
| #In my model, project.rb | |
| extend FriendlyId | |
| friendly_id :project_name, use: [:slugged, :finders] | |
| default_scope -> { order(created_at: :desc) } | |
| mount_uploaders :picture, PictureUploader | |
| #In index view | |
| <%= link_to image_tag(project.picture[0].url, class: "img-responsive"), project %> | |
| #In show view | |
| <% @project.picture.each do |picture, value| %> | |
| <ul class="project-image-list" id="imageGallery"> | |
| <li><%= link_to image_tag(picture.url, class: "project_image_show"), picture.url %></li> | |
| </ul> | |
| <% end %> | |
| #logs on index | |
| 2016-03-13T11:04:50.062544+00:00 app[web.1]: Started GET "/prosjekter" for 193.90.166.63 at 2016-03-13 11:04:50 +0000 | |
| 2016-03-13T11:04:50.064669+00:00 app[web.1]: Processing by ProjectsController#index as HTML | |
| 2016-03-13T11:04:50.064707+00:00 app[web.1]: Parameters: {"locale"=>"en"} | |
| 2016-03-13T11:04:50.067677+00:00 app[web.1]: Project Load (1.0ms) SELECT "projects".* FROM "projects" ORDER BY "projects"."created_at" DESC | |
| 2016-03-13T11:04:51.250120+00:00 heroku[router]: at=info method=GET path="/prosjekter" host=www.connexmalermester.no request_id=e46dd95d-90d1-4ffe-8fe0-43b32f15239b fwd="193.90.166.63" dyno=web.1 connect=0ms service=1188ms status=200 bytes=8162 | |
| 2016-03-13T11:04:51.243502+00:00 app[web.1]: User Load (1.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 1]] | |
| 2016-03-13T11:04:51.244404+00:00 app[web.1]: Rendered projects/_projects.html.erb (1178.0ms) | |
| 2016-03-13T11:04:51.244491+00:00 app[web.1]: Rendered projects/index.html.erb within layouts/application (1178.3ms) | |
| 2016-03-13T11:04:51.246148+00:00 app[web.1]: Rendered layouts/_header.html.erb (0.9ms) | |
| 2016-03-13T11:04:51.246717+00:00 app[web.1]: Rendered layouts/_signed_in.html.erb (0.4ms) | |
| 2016-03-13T11:04:51.247036+00:00 app[web.1]: Rendered layouts/_footer.html.erb (0.2ms) | |
| 2016-03-13T11:04:51.247375+00:00 app[web.1]: Completed 200 OK in 1183ms (Views: 1179.2ms | ActiveRecord: 2.1ms) | |
| #logs on show | |
| 2016-03-13T11:05:41.797462+00:00 app[web.1]: Started GET "/prosjekter/fdas" for 193.90.166.63 at 2016-03-13 11:05:41 +0000 | |
| 2016-03-13T11:05:41.799433+00:00 app[web.1]: Processing by ProjectsController#show as HTML | |
| 2016-03-13T11:05:41.799463+00:00 app[web.1]: Parameters: {"locale"=>"en", "id"=>"fdas"} | |
| 2016-03-13T11:05:41.801877+00:00 app[web.1]: Project Load (1.0ms) SELECT "projects".* FROM "projects" WHERE "projects"."slug" = $1 ORDER BY "projects"."created_at" DESC LIMIT 1 [["slug", "fdas"]] | |
| 2016-03-13T11:05:41.802721+00:00 app[web.1]: CACHE (0.0ms) SELECT "projects".* FROM "projects" WHERE "projects"."slug" = $1 ORDER BY "projects"."created_at" DESC LIMIT 1 [["slug", "fdas"]] | |
| 2016-03-13T11:05:44.337164+00:00 heroku[router]: at=info method=GET path="/prosjekter/fdas" host=www.connexmalermester.no request_id=69e57e36-b4ef-4637-a89c-39cecbb2c0cc fwd="193.90.166.63" dyno=web.1 connect=0ms service=2539ms status=200 bytes=8091 | |
| 2016-03-13T11:05:44.326576+00:00 app[web.1]: Rendered projects/show.html.erb within layouts/application (2523.2ms) | |
| 2016-03-13T11:05:44.328984+00:00 app[web.1]: Rendered layouts/_header.html.erb (1.4ms) | |
| 2016-03-13T11:05:44.331486+00:00 app[web.1]: User Load (1.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 1]] | |
| 2016-03-13T11:05:44.333181+00:00 app[web.1]: Rendered layouts/_signed_in.html.erb (0.9ms) | |
| 2016-03-13T11:05:44.333735+00:00 app[web.1]: Rendered layouts/_footer.html.erb (0.4ms) | |
| 2016-03-13T11:05:44.334226+00:00 app[web.1]: Completed 200 OK in 2535ms (Views: 2529.9ms | ActiveRecord: 2.1ms) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment