Class: Optimacms::DevController

Inherits:
ApplicationController show all
Defined in:
app/controllers/optimacms/dev_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_lang, #not_found

Methods included from ApplicationHelper

#block, #block_with_edit, #eval_meta_string, #fix_quotes, #meta_tags, #method_missing, #msg, #tinymce_editor_insert_block, #url_for

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Optimacms::ApplicationHelper

Instance Method Details

#addadminuserObject



26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/optimacms/dev_controller.rb', line 26

def addadminuser
  #return

  row = Optimacms::CmsAdminUser.where(email: '[email protected]').first || Optimacms::CmsAdminUser.new
  row.email = '[email protected]'
  row.password = 'password'
  row.password_confirmation = row.password

  row.save!
end

#check_envObject



6
7
8
# File 'app/controllers/optimacms/dev_controller.rb', line 6

def check_env
  return false unless Rails.env.development?
end

#fileObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/optimacms/dev_controller.rb', line 10

def file
  from = 'D:/mmx/projects/www/myrails/cms/site/test/dummy/public/files/1/cat_red.jpg'
  to = 'D:/mmx/projects/www/myrails/cms/site/test/dummy/public/files/1/supercat.jpg'

  f = 'D:/mmx/projects/www/myrails/cms/site/test/dummy/public/uploads/funny-cats-and-kittens-wallpapers-12.jpg'


  #FileUtils.move(from, to)

  require 'pathname'
  p = Pathname.new(f)
  p.unlink

  #FileUtils.rm(f)
end

#url1Object



37
38
39
40
41
42
43
44
45
# File 'app/controllers/optimacms/dev_controller.rb', line 37

def url1
  v = '[a-z\d\_]+'

  p = '(:pg)'
  p.gsub! /(\(\:#{v}\))([-\.]|$)/, '([^/]+|)\2'

  x = 0

end

#url2Object



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'app/controllers/optimacms/dev_controller.rb', line 47

def url2
  u = "news/3"
  r = /^news\/([^\/]+|)$/

  if u =~ /^news(\/.*|)$/

    x = $1
    y = $2

    z=0

  end
end