Skip to content

Instantly share code, notes, and snippets.

@frcake
Last active September 6, 2016 15:28
Show Gist options
  • Save frcake/70944be51b098761813d205e0b311c3d to your computer and use it in GitHub Desktop.
Save frcake/70944be51b098761813d205e0b311c3d to your computer and use it in GitHub Desktop.
Routing Error
uninitialized constant PhotosController
Rails.root: /home/frcake/workspace/Site/brokerv1/brokr
Application Trace | Framework Trace | Full Trace
Routes
Routes match in priority from top to bottom
Helper HTTP Verb Path Controller#Action
Path / Url
GET /
classifieds#index
signup_path GET /signup(.:format)
users#new
users_path GET /users(.:format)
users#index
POST /users(.:format)
users#create
new_user_path GET /users/new(.:format)
users#new
edit_user_path GET /users/:id/edit(.:format)
users#edit
user_path GET /users/:id(.:format)
users#show
PATCH /users/:id(.:format)
users#update
PUT /users/:id(.:format)
users#update
DELETE /users/:id(.:format)
users#destroy
POST /signup(.:format)
users#create
edit_path GET /edit/:id(.:format)
users#edit
update_path POST /update(.:format)
users#update
login_path GET /login(.:format)
sessions#new
POST /login(.:format)
sessions#create
logout_path DELETE /logout(.:format)
sessions#destroy
profile_path GET /profile/:id(.:format)
users#show
newlisting_path GET /newlisting(.:format)
classifieds#new
classifieds_path GET /classifieds(.:format)
classifieds#index
POST /classifieds(.:format)
classifieds#create
new_classified_path GET /classifieds/new(.:format)
classifieds#new
edit_classified_path GET /classifieds/:id/edit(.:format)
classifieds#edit
classified_path GET /classifieds/:id(.:format)
classifieds#show
PATCH /classifieds/:id(.:format)
classifieds#update
PUT /classifieds/:id(.:format)
classifieds#update
DELETE /classifieds/:id(.:format)
classifieds#destroy
POST /newlisting(.:format)
classifieds#create
editlisting_path GET /editlisting/:id(.:format)
classifieds#edit
listinglist_path GET /listing/:id(.:format)
users#list
back_path GET /back(.:format)
application#back
categories_path GET /categories(.:format)
categories#index
POST /categories(.:format)
categories#create
new_category_path GET /categories/new(.:format)
categories#new
edit_category_path GET /categories/:id/edit(.:format)
categories#edit
category_path GET /categories/:id(.:format)
categories#show
PATCH /categories/:id(.:format)
categories#update
PUT /categories/:id(.:format)
categories#update
DELETE /categories/:id(.:format)
categories#destroy
photo_path DELETE /photo(.:format)
photos#destroy
photos_path GET /photos(.:format)
photos#index
POST /photos(.:format)
photos#create
new_photo_path GET /photos/new(.:format)
photos#new
edit_photo_path GET /photos/:id/edit(.:format)
photos#edit
GET /photos/:id(.:format)
photos#show
PATCH /photos/:id(.:format)
photos#update
PUT /photos/:id(.:format)
photos#update
DELETE /photos/:id(.:format)
photos#destroy
Request
Parameters:
{"_method"=>"delete", "authenticity_token"=>"xYjfjNRNFwLJaBFim3cDoJbs3im4J8e28xnj+eCiBI88z53rQQWtaUPk0fZOqLVDk1spJ8GED9/15oTaiRzIxQ==", "format"=>"11"}
Toggle session dump
Toggle env dump
Response
Headers:
None
x
>>
class Photo < ApplicationRecord
belongs_to :classified, inverse_of: :photos
has_attached_file :image,
:styles => { :large => "600x170", :medium => "250x250!",:thumb => "100x100>" },
:default_url => ActionController::Base.helpers.image_path("/missing.png")
#,
#:default_url => lambda { |photo| photo.instance.set_default_url}
validates_attachment_content_type :image,
:content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif"]
validates_presence_of :classified
validates_attachment_presence :image
end
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
#map.resources :users, :has_many => :classifieds
get '/' => 'classifieds#index'
#get 'show/:id' => 'classifieds#show' , as: :classified
get 'signup' => 'users#new' , as: :signup
resources :users
post 'signup' => 'users#create'
get '/edit/:id' => 'users#edit' , as: :edit
post 'update' => 'users#update' , as: :update
get '/login' => 'sessions#new' , as: :login
post '/login' => 'sessions#create'
delete '/logout' => 'sessions#destroy'
get '/profile/:id' => 'users#show' , as: :profile
get '/newlisting' => 'classifieds#new' , as: :newlisting
resources :classifieds
post '/newlisting' => 'classifieds#create'
get '/editlisting/:id' => 'classifieds#edit' , as: :editlisting
# post 'update' => 'classifieds#update'
get '/listing/:id' => 'users#list' , as: :listinglist #list inside profile navtab
get 'back' => 'application#back' , as: :back
resources :categories
resources :photos, only: [:new, :create, :index, :destroy]
end
Prefix Verb URI Pattern Controller#Action
GET / classifieds#index
signup GET /signup(.:format) users#new
users GET /users(.:format) users#index
POST /users(.:format) users#create
new_user GET /users/new(.:format) users#new
edit_user GET /users/:id/edit(.:format) users#edit
user GET /users/:id(.:format) users#show
PATCH /users/:id(.:format) users#update
PUT /users/:id(.:format) users#update
DELETE /users/:id(.:format) users#destroy
POST /signup(.:format) users#create
edit GET /edit/:id(.:format) users#edit
update POST /update(.:format) users#update
login GET /login(.:format) sessions#new
POST /login(.:format) sessions#create
logout DELETE /logout(.:format) sessions#destroy
profile GET /profile/:id(.:format) users#show
newlisting GET /newlisting(.:format) classifieds#new
classifieds GET /classifieds(.:format) classifieds#index
POST /classifieds(.:format) classifieds#create
new_classified GET /classifieds/new(.:format) classifieds#new
edit_classified GET /classifieds/:id/edit(.:format) classifieds#edit
classified GET /classifieds/:id(.:format) classifieds#show
PATCH /classifieds/:id(.:format) classifieds#update
PUT /classifieds/:id(.:format) classifieds#update
DELETE /classifieds/:id(.:format) classifieds#destroy
POST /newlisting(.:format) classifieds#create
editlisting GET /editlisting/:id(.:format) classifieds#edit
listinglist GET /listing/:id(.:format) users#list
back GET /back(.:format) application#back
categories GET /categories(.:format) categories#index
POST /categories(.:format) categories#create
new_category GET /categories/new(.:format) categories#new
edit_category GET /categories/:id/edit(.:format) categories#edit
category GET /categories/:id(.:format) categories#show
PATCH /categories/:id(.:format) categories#update
PUT /categories/:id(.:format) categories#update
DELETE /categories/:id(.:format) categories#destroy
photos GET /photos(.:format) photos#index
POST /photos(.:format) photos#create
new_photo GET /photos/new(.:format) photos#new
photo DELETE /photos/:id(.:format) photos#destroy
<div class="new">
<div class="container-fluid">
<section class="container">
<div class="container-page">
<div class="col-md-6">
<h3 class="dark-grey">Εξοπλισμός προς πώληση</h3>
<%= form_for (@classified) do |f| %>
<% if @classified.errors.any? %>
<div id="error_explanation">
<h2>
<%= pluralize(@classified.errors.count, "error") %> prohibited
this article from being saved:
</h2>
<ul>
<% @classified.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="section1">
<div class="form-group col-lg-3">
<label>Μάρκα</label>
<%= f.text_field :make, :placeholder => "π.χ. Fender" , :class => "form-control"%>
</div>
<div class="form-group col-lg-6">
<label>Μοντέλο</label>
<%= f.text_field :model, :placeholder => "π.χ. Stratocaster" , :class => "form-control"%>
</div>
<div class="form-group col-lg-3">
<label>Έτος</label>
<%= f.text_field :year, :placeholder => "π.χ. 1992" , :class => "form-control"%>
</div>
<div class="form-group col-lg-5">
<label>Κατάσταση</label>
<%= f.text_field :condition, :placeholder => "" , :class => "form-control"%>
</div>
<div class="form-group col-lg-4">
<label>Χώρα κατασκευής</label>
<%= f.text_field :make_country, :placeholder => "" , :class => "form-control"%>
</div>
<div class="form-group col-lg-3">
<label>Τιμή</label>
<%= f.text_field :price, :placeholder => "" , :class => "form-control"%>
</div>
</div>
<div class="section2">
<div class="form-group col-lg-12">
<hr>
<label>Τίτλος Αγγελίας</label>
<%= f.text_field :title, :placeholder => "" , :class => "form-control"%>
</div>
<div class="form-group col-lg-12">
<h3 class="dark-grey">Περιγραφή</h3>
<%= f.text_area :description, rows: "15", :placeholder => "" , :class => "form-control"%>
</div>
</div>
<div class="section2">
<div class="form-group col-lg-12">
<hr>
<label>Κατηγορία</label>
<%= f.select :category_id, nested_set_options(Category, @category) {|i| "#{i.root.name unless !i.parent_id} #{'>' unless !i.parent_id} #{i.name}" } %>
</div>
</div>
<div class="section3">
<div class="form-group col-lg-12">
<hr>
<h3 class="dark-grey">Φωτογραφίες</h3>
<% @classified.photos.each do |z| %>
<%= image_tag z.image %>
<%= link_to "Delete Photo",photo_path(z), :method => :delete %>
<%end%>
<%= f.fields_for :photos do |p| %>
<%= p.file_field :image %>
<% end %>
</div>
</div>
<div class="linkbtn">
<%= f.submit nil, class: "btn-submit" %>
<% end %>
</div>
</div>
<div class="col-md-6 visible-lg">
<h3 class="dark-grey">Κατηγοριοποίηση αγγελίας</h3>
<div class="content">
<p>
Η σωστή κατηγοριοποίηση βοηθάει τόσο τους πιθανούς αγοραστές
</p>
<p>
Όσο και εμάς να προσφέρουμε τα σωστά αποτελέσματα στις αναζητήσεις
</p>
</div>
</div>
<div class="col-md-6 visible-lg">
<h3 class="dark-grey">Αναλυτική περιγραφή</h3>
<div class="content">
<p>
Περιγράψτε τον εξοπλισμό όσο καλύτερα μπορείτε
</p>
<p>
για να δώσετε μια καλή ιδέα στους πιθανούς αγοραστές
</p>
</div>
</div>
</div>
</div>
</section>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment