Skip to content

Instantly share code, notes, and snippets.

View frcake's full-sized avatar

mpdev frcake

  • Athens, Greece
View GitHub Profile
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
@frcake
frcake / console Classified.all
Last active July 26, 2016 09:07
Schema after db : migrate
c:\Site\brokerv1\brokr>rails console
Loading development environment (Rails 5.0.0)
irb(main):001:0> Classified.all
Classified Load (2.0ms) SELECT "classifieds".* FROM "classifieds"
=> #<ActiveRecord::Relation
[#<Classified id: 21, created_at: "2016-07-26 08:37:06", updated_at: "2016-07-26 08:37:06", make: nil, model: nil, year: nil, color: nil, title: nil, condition: nil, price: nil, offer: nil, make_country: nil, category: nil, description: nil, user_id: 4>,
#<Classified id:22, created_at: "2016-07-26 08:38:59", updated_at: "2016-07-26 08:38:59", make: nil, model: nil, year: nil, color: nil, title: nil, condition: nil, price: nil, offer: nil, make_country: nil, category: nil, description: nil, user_id: 4>,
#<Classified id: 23, created_at: "2016-07-26 08:43:30", updated_at: "2016-07-26 08:43:30", make: nil, model: nil, year: nil, color: nil, title: nil, condition: nil, price: nil, offer: nil, make_country: nil, category: nil, description: nil, user_id: 4>,
#<Classified id: 24, created_at: "2016-07-26 0
<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| %>
<div class="form-group col-lg-3">
<div class="container">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#home">Προφίλ</a></li>
<!--<li>Αγγελίες</a></li>-->
<li> <a data-toggle="tab" href="#menu1">a</a></li>
<li><a data-toggle="tab" href="#menu2">Μηνύματα</a></li>
<li><a data-toggle="tab" href="#menu3">Watchlist</a></li>
</ul>
<div class="new">
<div class="container-fluid">
<section class="container">
<div class="container-page">
<%= @user.classifieds.each do |c| %>
<%= link_to classified_path(c) do %>
<ul>
<li><%= c.title %></li>
<li><%= c.created_at %> </li>
</ul>
class Classified < ApplicationRecord
belongs_to :user
has_many :photos
accepts_nested_attributes_for :photos
end
<%=form_for categories_path do |f| %>
<%= f.select :parent_id, nested_set_options(Category, @category) {|i| "#{'-' * i.level} #{i.name}" } %>
<%= select_tag 'parent_id', options_for_select(nested_set_options(Category) {|i| "#{'-' * i.level} #{i.name}" } ) %>
<%end%>
<% nested_set_options(Category, @category).each do |f| %>
<%= link_to f%>
<%end%>
irb(main):015:0> accessorychild3 = Category.create!(:name=> "Cables")
(0.1ms) begin transaction
Category Load (0.2ms) SELECT "categories".* FROM "categories" ORDER BY "categories"."rgt" desc LIMIT ? [["LIMIT", 1]]
Category Load (0.1ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT ? [["id", 141], ["LIMIT", 1]]
SQL (0.3ms) INSERT INTO "categories" ("name", "lft", "rgt") VALUES (?, ?, ?) [["name", "Cables"], ["lft", 33], ["rgt", 34]]
Category Load (0.1ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT ? [["id", 143], ["LIMIT", 1]]
SQL (0.3ms) UPDATE "categories" SET "depth" = 0 WHERE "categories"."id" IN (SELECT "categories"."id" FROM "categories" WHERE "categories"."id" = 143 ORDER BY "categories"."lft")
(10.6ms) commit transaction
irb(main):021:0* accessorychild3.move_to_child_of(128)
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