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
#Вот модель task.rb | |
class Task < ActiveRecord::Base | |
extend FriendlyId | |
friendly_id :title, use: [:slugged, :finders] | |
has_many :taskstatus | |
has_many :users, through: :taskstatus | |
#Вот модель user.rb | |
class User < ActiveRecord::Base |
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
ActiveAdmin.register User do | |
permit_params :email, :name, :paid, :user_id | |
show do |t| | |
attributes_table do | |
row :email, label: "Почта" | |
row :name, label: "Имя" | |
row :paid, label: "Статус оплаты" | |
end |
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
ActiveAdmin.register Project do | |
permit_params :name, :content, :price, :image | |
show do |t| | |
attributes_table do | |
row :name | |
row :content | |
row :price | |
row :image do | |
project.image? ? image_tag(project.image, height: '100') : content_tag(:span, "No photo yet") |
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
Rails.application.routes.draw do | |
devise_for :users | |
get 'pages/about' | |
# The priority is based upon order of creation: first created -> highest priority. | |
# See how all your routes lay out with "rake routes". | |
# You can have the root of your site routed with "root" | |
# root 'welcome#index' |
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
Rails.application.routes.draw do | |
devise_for :users | |
get 'pages/about' | |
# The priority is based upon order of creation: first created -> highest priority. | |
# See how all your routes lay out with "rake routes". | |
# You can have the root of your site routed with "root" | |
# root 'welcome#index' |
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
class ApplicationController < ActionController::Base | |
# Prevent CSRF attacks by raising an exception. | |
# For APIs, you may want to use :null_session instead. | |
protect_from_forgery with: :exception | |
before_action :configure_permitted_parameters, if :devise_controller? | |
protected | |
def configure_permitted_parameters | |
devise_parameter_sanitizer.permit(:sign_up, keys: [:username, :email, :password, :password_confirmation, :remember_me]) | |
devise_parameter_sanitizer.permit(:sign_in, keys: [:username, :email, :password, :password_confirmation, :remember_me]) |
NewerOlder