Skip to content

Instantly share code, notes, and snippets.

View saroar's full-sized avatar
🏠
Working from home

Saroar Khandoker saroar

🏠
Working from home
View GitHub Profile
rake about # List versions of all Rails frameworks and the environment
rake acts_as_taggable_on_engine:install:migrations # Copy migrations from acts_as_taggable_on_engine to application
rake acts_as_taggable_on_engine:tag_names:collate_bin # Forcing collate of tag names to utf8_bin
rake acts_as_taggable_on_engine:tag_names:collate_ci # Forcing collate of tag names to utf8_general_ci
rake assets:clean[keep] # Remove old compiled assets
rake assets:clobber # Remove compiled assets
rake assets:environment # Load asset compile environment
rake assets:precompile # Compile all the assets named in config.assets.precompile
rake bourbon:install[sass_path] # Move files to the Rails assets directory
rake cache_digests:dependencies # Lookup first-level dependencies for TEMPLATE (like messages/show
# == Schema Information
#
# Table name: sub_workings
#
# id :integer not null, primary key
# sub_working_title :string
# created_at :datetime not null
# updated_at :datetime not null
# specialist_id :integer
# working_hour :integer
ActiveAdmin.register NutritionData do
menu false
form do |f|
f.inputs "Details" do
f.input :item_id, :as => :hidden
f.input :header, :input_html => {:rows => 5}
f.input :serving, :input_html => {:rows => 5}
f.input :calories
f.input :calories_from_fat
= semantic_nested_form_for [:admin, @project] do |f|
= f.inputs "Project Details" do
= f.input :start_date, as: :date_picker
= f.input :doc_name
= f.input :project_name
= f.input :end_date, as: :date_picker
= f.input :company_id, as: :select, collection: Company.all.map {|c| [c.company_name, c.id]}
= f.input :working_estimate_id, as: :check_boxes, collection: WorkingEstimate.all.map {|c| [c.working_title, c.id]}
br
def self.remove_dup
#SubWorking.select(:sub_working_title).group(:sub_working_title).having("count(*) > 1")
value = nil
SubWorking.order("sub_working_title ASC").each do |record|
if record.sub_working_title == value
# duplicate
record.destroy
else
# first entry
value = record.sub_working_title
# Project form
= semantic_form_for [:admin, @project] do |f|
= f.inputs "Project Details" do
= f.input :start_date, as: :date_picker
= f.input :doc_name
= f.input :project_name
= f.input :end_date, as: :date_picker
= f.input :company_id, as: :select, collection: Company.all.map {|c| [c.company_name, c.id]}
= f.input :working_estimate_ids, as: :check_boxes, collection: WorkingEstimate.all.map {|c| [c.working_title, c.id]}
["Design", "iOS Application Development", "Research and design", "ANDROID APPLICATIONS DEVELOPMENT"].each do |we|
WorkingEstimate.find_or_create_by(working_title: we)
end
SubWorking.find_or_create_by(title: 'Design research', working_hour: 24)
SubWorking.find_or_create_by(title: 'Interaction design (IxD)', working_hour: 24)
SubWorking.find_or_create_by(title: 'Elaboration of scenarios (Use Flow)', working_hour: 24)
SubWorking.find_or_create_by(title: 'Interface Design (Wireframe)', working_hour: 24)
class WorkingEstimate < ActiveRecord::Base
has_ancestry
has_many :project_working_estimates, dependent: :destroy
has_many :projects, through: :project_working_estimates
has_many :working_estimate_sub_workings, dependent: :destroy
has_many :sub_workings, through: :working_estimate_sub_workings
accepts_nested_attributes_for :sub_workings, allow_destroy: true
def find_meta_tags(options={})
site_name = "OZ INTERACTIVE"
description = "OZ INTERACTIVE – исследование, аналитика, проектирование, дизайн и разработка"
keywords = %w[исследование аналитика проектирование дизайн и разработка]
image = options[:image] || "logo.svg"
current_url = request.url
found_meta_tags = MetaTag.where(url: request.path)
if found_meta_tags.present?
Started GET "/admin/meta_tags" for 127.0.0.1 at 2016-09-02 23:06:32 +0300
Processing by Admin::MetaTagsController#index as HTML
MetaTag Load (0.3ms) SELECT "meta_tags".* FROM "meta_tags" WHERE "meta_tags"."url" = $1 [["url", "/admin/meta_tags"]]
User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 3]]
Role Load (0.4ms) SELECT "roles".* FROM "roles" INNER JOIN "users_roles" ON "roles"."id" = "users_roles"."role_id" WHERE "users_roles"."user_id" = $1 AND (((roles.name = 'admin') AND (roles.resource_type IS NULL) AND (roles.resource_id IS NULL))) [["user_id", 3]]
CACHE (0.0ms) SELECT "roles".* FROM "roles" INNER JOIN "users_roles" ON "roles"."id" = "users_roles"."role_id" WHERE "users_roles"."user_id" = $1 AND (((roles.name = 'admin') AND (roles.resource_type IS NULL) AND (roles.resource_id IS NULL))) [["user_id", 3]]
Rendered /Users/alif/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activeadmin-1.0.0.pre4/app/views/active_admin/re