Если не сложно, то можно объяснить по синтаксису моменты, как это работает, и что за "костыль" с переменной |form|?
form_with(...) do |form|
end
rails routes
и надо понимать что такое CRUD, REST.# Adding a scope prefixes the input field names:
t.references :commentable, polymorphic: true
.all.each &:update
.update_all({ "$set" => { image_url: "$pic" }})
new_obj = {id: new_id, models: []}
prev_model = nil
obj[:models].each do |m|
new_model = m.dup
new_model[:parent_id] = prev_model[:id] unless prev_model.nil?
new_obj[:models] << new_model
prev_model = new_model
end
No route matches [GET] "/json"
No rule to make target '/D/Ruby26-x64/include/ruby-2.6.0/ruby.h', needed by 'websocket_mask.o'
ActiveAdmin.register Page do
permit_params :body, :name
index do
column :name
column :created_at
column :updated_at
actions
end
form do |f|
f.inputs "Page Details" do
f.input :name
f.input :body, as: :text, input_html: { class: "tinymce" }
end
f.actions
end
end
sudo apt install ruby sqlite3 libsqlite3-dev
sudo gem install sqlite3-ruby
validate :check_district_js_null
validates :district,
numericality: {only_integer: true, greater_than_or_equal_to: -1, allow_nil: true}
def check_district_js_null
self.district = nil if self.district == 'null'
end
class CreateCategories < ActiveRecord::Migration def self.up create_table :category do |t| t.string :text t.references :parent t.timestamps end end end
class Category < ActiveRecord::Base has_many :subcategories, :class_name => "Category", :foreign_key => "parent_id", :dependent => :destroy belongs_to :parent_category, :class_name => "Category" end
link_to ..., ..., remote: true
respond_to do |format|
format.js { render :layout => false}
end