Class: UserTextCopiesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- UserTextCopiesController
- Defined in:
- app/controllers/user_text_copies_controller.rb
Overview
typed: false
Instance Method Summary collapse
-
#create ⇒ Object
POST /user_text_copies POST /user_text_copies.json.
-
#destroy ⇒ Object
DELETE /user_text_copies/1 DELETE /user_text_copies/1.json.
-
#edit ⇒ Object
GET /user_text_copies/1/edit.
-
#index ⇒ Object
GET /user_text_copies GET /user_text_copies.json.
-
#new ⇒ Object
GET /user_text_copies/new.
- #pasted_one ⇒ Object
-
#show ⇒ Object
GET /user_text_copies/1 GET /user_text_copies/1.json.
-
#update ⇒ Object
PATCH/PUT /user_text_copies/1 PATCH/PUT /user_text_copies/1.json.
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
POST /user_text_copies POST /user_text_copies.json
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'app/controllers/user_text_copies_controller.rb', line 44 def create fail "no adult" unless ENV["EZII_ADULT_PASSWORD"] == params["ezii_adult_password"] fail if UserTextCopy.last.pasting_started @ezii_adult_verify_and_signin = EziiAdultVerifyAndSignin.new(ezii_adult_verify_and_signin_params) @user_text_copy = UserTextCopy.new(user_text_copy_params) @user_text_copy.ezii_adult_verify_and_signin = @ezii_adult_verify_and_signin respond_to do |format| if @user_text_copy.save! # § §(LIMIT_SQL_SELECT_TO_TEN_TOTAL_RECORDS) do copies = [] §⚕(LIMIT_SQL_SELECT_TO_TEN_TOTAL_RECORDS) do # copies = @user_text_copy.copies.limit(10) ladder end # byebug # ⚕ ActionCable.server.broadcast( "all", copies: copies, pastes: copies.reverse ) end format.html { redirect_to @user_text_copy, notice: 'User text copy was successfully created.' } format.json { render :show, status: :created, location: @user_text_copy } else format.html { render :new } format.json { render json: @user_text_copy.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /user_text_copies/1 DELETE /user_text_copies/1.json
95 96 97 98 99 100 101 |
# File 'app/controllers/user_text_copies_controller.rb', line 95 def destroy @user_text_copy.destroy respond_to do |format| format.html { redirect_to user_text_copies_url, notice: 'User text copy was successfully destroyed.' } format.json { head :no_content } end end |
#edit ⇒ Object
GET /user_text_copies/1/edit
31 32 |
# File 'app/controllers/user_text_copies_controller.rb', line 31 def edit end |
#index ⇒ Object
GET /user_text_copies GET /user_text_copies.json
10 11 12 |
# File 'app/controllers/user_text_copies_controller.rb', line 10 def index @user_text_copies = UserTextCopy.all end |
#new ⇒ Object
GET /user_text_copies/new
26 27 28 |
# File 'app/controllers/user_text_copies_controller.rb', line 26 def new @user_text_copy = UserTextCopy.new end |
#pasted_one ⇒ Object
34 35 36 37 38 39 40 |
# File 'app/controllers/user_text_copies_controller.rb', line 34 def pasted_one # params[:id] == 'latest' utc = UserTextCopy.last utc.pasting_started = true utc.pastes_used += 1 utc.save! end |
#show ⇒ Object
GET /user_text_copies/1 GET /user_text_copies/1.json
16 17 18 19 20 21 22 23 |
# File 'app/controllers/user_text_copies_controller.rb', line 16 def show if params[:id] == 'next_paste' utc = UserTextCopy.last paste = utc.copies.split(',').last(10).reverse[-utc.pastes_used] render plain: paste, layout: nil end end |
#update ⇒ Object
PATCH/PUT /user_text_copies/1 PATCH/PUT /user_text_copies/1.json
81 82 83 84 85 86 87 88 89 90 91 |
# File 'app/controllers/user_text_copies_controller.rb', line 81 def update respond_to do |format| if @user_text_copy.update(user_text_copy_params) format.html { redirect_to @user_text_copy, notice: 'User text copy was successfully updated.' } format.json { render :show, status: :ok, location: @user_text_copy } else format.html { render :edit } format.json { render json: @user_text_copy.errors, status: :unprocessable_entity } end end end |