app/models/optimacms/page.rb
def _before_save

      if self.url_changed?
        self.url_parts_count = PageServices::PageRouteService.count_url_parts(self.url)
        self.url_vars_count = PageServices::PageRouteService::count_url_vars(self.url)
        self.parsed_url = PageServices::PageRouteService::parse_url(self.url)
      end
    end
def _before_save

      if self.url_changed?
        self.url_parts_count = PageServices::PageRouteService.count_url_parts(self.url)
        self.url_vars_count = PageServices::PageRouteService::count_url_vars(self.url)
        self.parsed_url = PageServices::PageRouteService::parse_url(self.url)
      end
    end
search
=begin
    def self.search_by_filter(filter)
      pg = filter.page
      #pg =1 if pg.nil? || pg<=0

      order = filter.order

      if order.empty?
        orderby = 'id'
        orderdir = 'asc'
      else
        orderby = order[0][0]
        orderdir = order[0][1]
      end

      self.where(get_where(filter.data))
        .order(" #{orderby} #{orderdir}")
        .page(pg)

    end

    def self.get_where(values)
      w = '1=1 '
      #w << " AND uid like '#{values['uid']}%' " if values['uid'] && !values['uid'].blank?
      v = values[:title]
      w << " AND title like '%#{v}%' " if v && !v.blank?

      v = values[:parent_id]
      w << " AND parent_id = '#{v}' " if !v!=-1

      w
    end
=end