Class: Website

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
FriendlyId
Defined in:
app/models/website.rb

Overview

create_table :websites do |t|

t.string :name
t.string :title
t.string :subtitle
t.string :internal_identifier
t.boolean :publishing, :default => false

t.timestamps

end

add_index :websites, :internal_identifier, :name => ‘websites_internal_identifier_idx’

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find_by_host(host) ⇒ Object



409
410
411
412
413
414
415
416
# File 'app/models/website.rb', line 409

def find_by_host(host)
  website = nil
  unless host.nil?
    website_host = WebsiteHost.find_by_host(host)
    website = website_host.website unless website_host.nil?
  end
  website
end

.find_site_entry_in_zip(file) ⇒ Object



646
647
648
649
650
651
652
653
# File 'app/models/website.rb', line 646

def find_site_entry_in_zip(file)
  zf = Zip::ZipFile.open(file)
  zf.each_with_index { |entry, index|
    if entry.name.match(/-template.zip/) && !entry.name.match(/_./)
      return entry
    end
  }
end

.find_theme_entries_in_zip(file) ⇒ Object



655
656
657
658
659
660
661
662
663
664
# File 'app/models/website.rb', line 655

def find_theme_entries_in_zip(file)
  entries = []
  zf = Zip::ZipFile.new(file)
  zf.each_with_index { |entry, index|
    if entry.name.match(/-theme.zip/) && !entry.name.match(/_./)
      entries << entry
    end
  }
  entries
end

.import(file_path, current_user) ⇒ Object



424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
# File 'app/models/website.rb', line 424

def import(file_path, current_user)
  file_support = ErpTechSvcs::FileSupport::Base.new(:storage => Rails.application.config.erp_tech_svcs.file_storage)
  message = ''
  website = nil

  # if the path to the file is passed just use it else get the path from

  # the File object that was passed

  unless file_path.is_a?(String)
    if file_path.path
      file_path = file_path.path
    else
      file = ActionController::UploadedTempfile.new("uploaded-website").tap do |f|
        f.puts file_path.read
        f.original_filename = file_path.original_filename
        f.read # no idea why we need this here, otherwise the zip can't be opened

      end
      file_path = file.path
    end
  end

  entries = []
  setup_hash = nil

  tmp_dir = Website.make_tmp_dir
  Zip::ZipFile.open(file_path) do |zip|
    zip.each do |entry|
      f_path = File.join(tmp_dir.to_s, entry.name)
      FileUtils.mkdir_p(File.dirname(f_path))
      zip.extract(entry, f_path) unless File.exist?(f_path)

      next if entry.name =~ /__MACOSX\//
      if entry.name =~ /setup.yml/
        data = ''
        entry.get_input_stream { |io| data = io.read }
        data = StringIO.new(data) if data.present?
        setup_hash = YAML.load(data)
      else
        type = entry.name.split('/')[0]
        name = entry.name.split('/').last
        next if name.nil?

        if File.exist?(f_path) and !File.directory?(f_path)
          entry_hash = {:type => type, :name => name, :path => entry.name}
          entries << entry_hash unless name == 'sections' || name == 'articles' || name == 'excerpts' || name == 'documented contents'
          entry_hash[:data] = File.open(f_path, "rb") { |io| io.read }
        end
      end

    end
  end
  entries.uniq!
  FileUtils.rm_rf(tmp_dir.to_s)

  if Website.find_by_internal_identifier(setup_hash[:internal_identifier]).nil?
    website = Website.new(
        :name => setup_hash[:name],
        :title => setup_hash[:title],
        :subtitle => setup_hash[:subtitle],
        :internal_identifier => setup_hash[:internal_identifier]
    )

    #TODO update to handle configurations


    website.save!

    #set default publication published by user

    first_publication = website.published_websites.first
    first_publication.published_by = current_user
    first_publication.save

    begin
      #handle images

      setup_hash[:images].each do |image_asset|
        filename = 'images' + image_asset[:path] + '/' + image_asset[:name]
        #puts "image_asset '#{filename}'"

        content = entries.find { |entry| entry[:type] == 'images' and entry[:path] == filename }
        unless content.nil?
          website.add_file(content[:data], File.join(file_support.root, image_asset[:path], image_asset[:name]))
        end
      end

      if setup_hash[:members]
        #handle members

        website_role_type_parent = RoleType.find_or_create('website', 'Website')
        website_member_role = RoleType.find_or_create('member', 'Member', website_role_type_parent)

        setup_hash[:members].each do |member|
          user = User.find_by_username(member)

          if user
            # add website security role to user

            user.add_role(website.role)

            # create website_party_role for this user as a member of the site

            WebsitePartyRole.create(party: user.party, website: website, role_type: website_member_role)

            user.save
          end
        end
      end

      #handle files

      setup_hash[:files].each do |file_asset|
        filename = 'files' + file_asset[:path] + '/' + file_asset[:name]
        content = entries.find { |entry| entry[:type] == 'files' and entry[:path] == filename }
        unless content.nil?
          file = website.add_file(content[:data], File.join(file_support.root, file_asset[:path], file_asset[:name]))

          #handle security

          unless file_asset[:roles].empty?
            capability = file.add_capability(:download)
            file_asset[:roles].each do |role_iid|
              role = SecurityRole.find_by_internal_identifier(role_iid)
              role.add_capability(capability)
            end
          end
        end
      end

      #handle hosts

      setup_hash[:hosts].each do |host|
        website.hosts << WebsiteHost.create(:host => host)
        website.save
      end

      if !setup_hash[:hosts].blank? and !setup_hash[:hosts].empty?
        #set first host as primary host in configuration

        website.configurations.first.update_configuration_item(ConfigurationItemType.find_by_internal_identifier('primary_host'), setup_hash[:hosts].first)
        website.save
      end

      #handle sections

      setup_hash[:sections].each do |section_hash|
        build_section(section_hash, entries, website, current_user)
      end
      website.website_sections.update_paths!

      #handle website_navs

      setup_hash[:website_navs].each do |website_nav_hash|
        website_nav = WebsiteNav.new(:name => website_nav_hash[:name])
        website_nav_hash[:items].each do |item|
          website_nav.website_nav_items << build_menu_item(item)
        end
        website.website_navs << website_nav
      end

      website.publish("Website Imported", current_user)

    rescue => ex
      Rails.logger.error "#{ex.inspect} #{ex.backtrace}"
      website.destroy unless website.nil?
      raise ex
    end

    website.save

    # set the currents users dba_org as the dba_org for this website

    WebsitePartyRole.create(website: website,
                            party: current_user.party.dba_organization,
                            role_type: RoleType.iid('dba_org'))
  else
    message = 'Website already exists with that internal_identifier'
  end

  return website, message
end

.import_template(file, current_user) ⇒ Object



591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
# File 'app/models/website.rb', line 591

def import_template(file, current_user)
  file = ActionController::UploadedTempfile.new("uploaded-template").tap do |f|
    f.puts file.read
    f.original_filename = file.original_filename
    f.read # no idea why we need this here, otherwise the zip can't be opened

  end unless file.path

  result = {website: nil, theme: nil, success: false}

  entries = []
  begin
    Zip::ZipFile.open(file.path) do |zip_file|
      zip_file.each do |f|
        f_path = File.join('tmp/template_import', f.name)
        FileUtils.mkdir_p(File.dirname(f_path))
        zip_file.extract(f, f_path) unless File.exist?(f_path)
        entries << {name: f.name, path: f_path}
      end
    end

    entries.each do |entry|
      if entry[:name].match(/-website.zip/)
        result[:website], result[:message] = import(entry[:path], current_user)
      end
    end

    if result[:website]
      entries.each do |entry|
        if entry[:name].match(/-theme.zip/)
          result[:theme] = Theme.import(entry[:path], result[:website], true)
        end
      end
    else
      raise result[:message]
    end

    FileUtils.rm_rf('tmp/template_import')

    result[:success] = true
  rescue Exception => e
    Rails.logger.error(e.message)
    Rails.logger.error(e.backtrace.join("\n"))

    if result[:website]
      result[:website].destroy
      result[:website] = nil
    end

    result[:message] = 'Error importing theme'
    result[:success] = false
  end

  result
end

.make_tmp_dirObject



418
419
420
421
422
# File 'app/models/website.rb', line 418

def make_tmp_dir
  Pathname.new(File.join(Rails.root, "/tmp/website_export/tmp_#{Time.now.to_i.to_s}")).tap do |dir|
    FileUtils.mkdir_p(dir) unless dir.exist?
  end
end

.scope_by_dba_organization(dba_organization) ⇒ ActiveRecord::Relation

Scope websites by passed dba_organization(s)

or an array of dba_organizations to scope by

Parameters:

  • dba_organization (Party, Array)

    Either a single dba_organization to scope by

Returns:

  • (ActiveRecord::Relation)

    Websites scope by ba_organization(s)



403
404
405
406
407
# File 'app/models/website.rb', line 403

def scope_by_dba_organization(dba_organization)
  joins(website_party_roles: [:party, :role_type])
      .where(role_types: {internal_identifier: 'dba_org'})
      .where(parties: {id: dba_organization})
end

Instance Method Details

#active_publicationObject



143
144
145
# File 'app/models/website.rb', line 143

def active_publication
  self.published_websites.where(:active => true).first
end

#add_party_with_role(party, role_type) ⇒ Object



107
108
109
110
# File 'app/models/website.rb', line 107

def add_party_with_role(party, role_type)
  self.website_party_roles << WebsitePartyRole.create(:party => party, :role_type => role_type)
  self.save
end

#all_section_pathsObject



112
113
114
# File 'app/models/website.rb', line 112

def all_section_paths
  WebsiteSection.select(:path).where(:website_id => self.id).collect { |row| row['path'] }
end

#auto_activate_publication?Boolean

Returns:

  • (Boolean)


147
148
149
150
151
152
153
154
# File 'app/models/website.rb', line 147

def auto_activate_publication?
  configuration_item = self.configurations.first.get_item(:auto_active_publications)
  unless configuration_item.nil?
    configuration_item.options.first.value == 'yes'
  else
    false
  end
end

#config_value(config_item_type_iid) ⇒ Object



116
117
118
119
# File 'app/models/website.rb', line 116

def config_value(config_item_type_iid)
  primary_host_config_item_type = ConfigurationItemType.find_by_internal_identifier(config_item_type_iid)
  self.configurations.first.get_configuration_item(primary_host_config_item_type).options.first.value
end

#dba_organizationObject



90
91
92
# File 'app/models/website.rb', line 90

def dba_organization
  self.website_party_roles.where(role_type_id: RoleType.iid('dba_org')).first.party
end

#deactivate_themes!Object



125
126
127
128
129
# File 'app/models/website.rb', line 125

def deactivate_themes!
  themes.each do |theme|
    theme.deactivate!
  end
end

#destroy_sectionsObject

We only want to destroy parent sections as better nested set will destroy children for us



71
72
73
74
75
76
77
78
79
80
# File 'app/models/website.rb', line 71

def destroy_sections
  parents = []
  website_sections.each do |section|
    unless section.child?
      parents << section
    end
  end

  parents.each { |parent| parent.destroy }
end

#destroy_website_party_rolesObject



86
87
88
# File 'app/models/website.rb', line 86

def destroy_website_party_roles
  ActiveRecord::Base.connection.execute("delete from website_party_roles where website_id = #{self.id}")
end

#destroy_website_security_roleObject



82
83
84
# File 'app/models/website.rb', line 82

def destroy_website_security_role
  ActiveRecord::Base.connection.execute("delete from parties_security_roles where security_role_id = #{self.role.id}")
end

#email_inquiries?Boolean

Returns:

  • (Boolean)


121
122
123
# File 'app/models/website.rb', line 121

def email_inquiries?
  config_value('email_inquiries') == 'yes'
end

#exportObject



278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# File 'app/models/website.rb', line 278

def export
  tmp_dir = Website.make_tmp_dir
  file_support = ErpTechSvcs::FileSupport::Base.new(:storage => Rails.application.config.erp_tech_svcs.file_storage)

  sections_path = Pathname.new(File.join(tmp_dir, 'sections'))
  FileUtils.mkdir_p(sections_path) unless sections_path.exist?

  articles_path = Pathname.new(File.join(tmp_dir, 'articles'))
  FileUtils.mkdir_p(articles_path) unless articles_path.exist?

  documented_contents_path = Pathname.new(File.join(tmp_dir, 'documented contents'))
  FileUtils.mkdir_p(documented_contents_path) unless documented_contents_path.exist?

  excerpts_path = Pathname.new(File.join(tmp_dir, 'excerpts'))
  FileUtils.mkdir_p(excerpts_path) unless excerpts_path.exist?

  image_assets_path = Pathname.new(File.join(tmp_dir, 'images'))
  FileUtils.mkdir_p(image_assets_path) unless image_assets_path.exist?

  file_assets_path = Pathname.new(File.join(tmp_dir, 'files'))
  FileUtils.mkdir_p(file_assets_path) unless file_assets_path.exist?

  sections.where('parent_id is null').each do |website_section|
    save_section_layout_to_file(sections_path, website_section)
  end

  contents = sections.collect(&:contents).flatten.uniq
  contents.each do |content|
    File.open(File.join(articles_path, "#{content.internal_identifier}.html"), 'wb+') { |f| f.puts(content.body_html) }
    unless content.excerpt_html.blank?
      File.open(File.join(excerpts_path, "#{content.internal_identifier}.html"), 'wb+') { |f| f.puts(content.excerpt_html) }
    end
  end

  online_document_sections.each do |online_documented_section|
    extension = online_documented_section.use_markdown == true ? 'md' : 'html'
    File.open(File.join(documented_contents_path, "#{online_documented_section.internal_identifier}.#{extension}"), 'wb+') { |f| f.puts(online_documented_section.documented_item_published_content_html(active_publication)) }
  end

  self.files.where("directory like '%/sites/#{self.iid}/images%'").all.each do |image_asset|
    contents = file_support.get_contents(File.join(file_support.root, image_asset.directory, image_asset.name))
    FileUtils.mkdir_p(File.join(image_assets_path, image_asset.directory))
    File.open(File.join(image_assets_path, image_asset.directory, image_asset.name), 'wb+') { |f| f.puts(contents) }
  end

  self.files.where("directory like '%/#{Rails.application.config.erp_tech_svcs.file_assets_location}/sites/#{self.iid}%'").all.each do |file_asset|
    contents = file_support.get_contents(File.join(file_support.root, file_asset.directory, file_asset.name))
    FileUtils.mkdir_p(File.join(file_assets_path, file_asset.directory))
    File.open(File.join(file_assets_path, file_asset.directory, file_asset.name), 'wb+') { |f| f.puts(contents) }
  end

  files = []
  Dir.glob("#{tmp_dir.to_s}/**/*").each do |entry|
    next if entry =~ /^\./
    path = entry
    entry = entry.gsub(Regexp.new(tmp_dir.to_s), '')
    entry = entry.gsub(Regexp.new(/^\//), '')
    files << {:path => path, :name => entry}
  end

  File.open(tmp_dir + 'setup.yml', 'wb+') { |f| f.puts(export_setup.to_yaml) }

  (tmp_dir + "#{name}.zip").tap do |file_name|
    file_name.unlink if file_name.exist?
    Zip::ZipFile.open(file_name.to_s, Zip::ZipFile::CREATE) do |zip|
      files.each { |file| zip.add(file[:name], file[:path]) if File.exists?(file[:path]) }
      zip.add('setup.yml', tmp_dir + 'setup.yml')
    end
  end

end

#export_setupObject



233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
# File 'app/models/website.rb', line 233

def export_setup
  setup_hash = {
      :name => name,
      :hosts => hosts.collect(&:host),
      :title => title,
      :subtitle => subtitle,
      :internal_identifier => internal_identifier,
      :sections => [],
      :images => [],
      :files => [],
      :website_navs => [],
      :members => []
  }

  #TODO update to handle configurations


  setup_hash[:sections] = sections.positioned.collect do |website_section|
    website_section.build_section_hash
  end

  setup_hash[:website_navs] = website_navs.collect do |website_nav|
    {
        :name => website_nav.name,
        :items => website_nav.items.positioned.map { |website_nav_item| website_nav_item.build_menu_item_hash }
    }
  end

  self.files.where("directory like '%/sites/#{self.iid}/images%'").all.each do |image_asset|
    setup_hash[:images] << {:path => image_asset.directory, :name => image_asset.name}
  end

  self.files.where("directory like '%/#{Rails.application.config.erp_tech_svcs.file_assets_location}/sites/#{self.iid}%'").all.each do |file_asset|
    setup_hash[:files] << {:path => file_asset.directory, :name => file_asset.name, :roles => file_asset.roles.uniq.collect { |r| r.internal_identifier }}
  end

  # get all members of the website

  self.website_party_roles.where('role_type_id = ?', RoleType.find_by_ancestor_iids(['website', 'member'])).each do |website_party_role|
    party = website_party_role.party

    setup_hash[:members] << party.user.username
  end

  setup_hash
end

#export_templateObject



367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# File 'app/models/website.rb', line 367

def export_template
  tmp_dir = Website.make_tmp_dir
  website_zip_path = export

  unless themes.active.first.is_a?(Theme)
    return false
  end

  theme_zip_path = themes.active.first.export

  zip_file_name = File.join(tmp_dir, self.iid + '-composite.zip')

  Zip::ZipFile.open(zip_file_name, Zip::ZipFile::CREATE) do |zip_file|
    zip_file.add(File.basename(website_zip_path, '.zip') + '-website.zip', website_zip_path)
    zip_file.add(File.basename(theme_zip_path, '.zip') + '-theme.zip', theme_zip_path)
  end

  File.join(tmp_dir, self.iid + '-composite.zip')
end

#iidObject

creating method because we only want a getter, not a setter for iid



103
104
105
# File 'app/models/website.rb', line 103

def iid
  self.internal_identifier
end

#publish(comment, current_user) ⇒ Object



135
136
137
# File 'app/models/website.rb', line 135

def publish(comment, current_user)
  self.published_websites.last.publish(comment, current_user)
end

#publish_element(comment, element, version, current_user) ⇒ Object



131
132
133
# File 'app/models/website.rb', line 131

def publish_element(comment, element, version, current_user)
  self.published_websites.last.publish_element(comment, element, version, current_user)
end

#publish_on_save?Boolean

Returns:

  • (Boolean)


156
157
158
159
160
161
162
163
# File 'app/models/website.rb', line 156

def publish_on_save?
  configuration_item = self.configurations.first.get_item(:publish_on_save)
  unless configuration_item.nil?
    configuration_item.options.first.value == 'yes'
  else
    false
  end
end

#publishing?Boolean

Returns:

  • (Boolean)


94
95
96
# File 'app/models/website.rb', line 94

def publishing?
  self.publishing
end

#remove_sites_directoryObject



184
185
186
187
188
189
190
191
# File 'app/models/website.rb', line 184

def remove_sites_directory
  file_support = ErpTechSvcs::FileSupport::Base.new(:storage => Rails.application.config.erp_tech_svcs.file_storage)
  begin
    file_support.delete_file(File.join(file_support.root, "sites/#{self.iid}"), :force => true)
  rescue
    #do nothing it may not exist

  end
end

#remove_website_roleObject



193
194
195
# File 'app/models/website.rb', line 193

def remove_website_role
  role.destroy if role
end

#roleObject



165
166
167
# File 'app/models/website.rb', line 165

def role
  SecurityRole.iid(website_role_iid)
end

#save_section_layout_to_file(sections_path, website_section) ⇒ Object



350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
# File 'app/models/website.rb', line 350

def save_section_layout_to_file(sections_path, website_section)
  unless website_section.layout.blank?
    File.open(File.join(sections_path, "#{website_section.permalink}.rhtml"), 'wb+') { |f| f.puts(website_section.layout) }
  end

  # we need to handle child sections because internal identifier uniqueness is scoped by parent_id and website_id

  # get all children of this section

  unless website_section.children.empty?
    sections_path = Pathname.new(File.join(sections_path, website_section.permalink))
    FileUtils.mkdir_p(sections_path) unless sections_path.exist?

    website_section.children.each do |website_section_child|
      save_section_layout_to_file(sections_path, website_section_child)
    end
  end
end

#set_publication_version(version, current_user) ⇒ Object



139
140
141
# File 'app/models/website.rb', line 139

def set_publication_version(version, current_user)
  PublishedWebsite.activate(self, version, current_user)
end

#setup_default_pagesObject



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'app/models/website.rb', line 197

def setup_default_pages
  # create default sections for each widget using widget layout

  widget_classes = [
      ::Widgets::ContactUs::Base,
      ::Widgets::Search::Base,
      ::Widgets::ManageProfile::Base,
      ::Widgets::::Base,
      ::Widgets::::Base,
      ::Widgets::ResetPassword::Base
  ]
  profile_page = nil
  widget_classes.each do |widget_class|
    website_section = WebsiteSection.new

    # AE-194: Inline Search is active, so no need for search page, take search layout

    # but change section name for the Search Results page 

    # and change layout so render widget to calls search action

    website_section.in_menu = true unless ["Login", "Sign Up", "Reset Password", "Search"].include?(widget_class.title)
    if widget_class.title == 'Search'
      website_section.title = 'Search Results'
      website_section.layout = widget_class.base_layout.gsub(":search", ":search, :action => 'search'")
    else
      website_section.title = widget_class.title
      website_section.layout = widget_class.base_layout
    end
    website_section.save

    profile_page = website_section if widget_class.title == 'Manage Profile'

    self.website_sections << website_section
  end
  self.save
  self.website_sections.update_paths!
  profile_page.secure unless profile_page.nil?
end

#setup_websiteObject



169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'app/models/website.rb', line 169

def setup_website
  PublishedWebsite.create(:website => self, :version => 0, :active => true, :comment => 'New Site Created')

  if self.role.nil?
    website_role = SecurityRole.create(:description => "Website #{self.title}", :internal_identifier => website_role_iid)
    website_role.move_to_child_of(SecurityRole.iid('website_builder'))
  end

  configuration = ::Configuration.find_template('default_website_configuration').clone(true, "Website #{self.title} Configuration", "Website #{self.title} Configuration".underscore)
  configuration.update_configuration_item(ConfigurationItemType.find_by_internal_identifier('login_url'), '/login')
  configuration.update_configuration_item(ConfigurationItemType.find_by_internal_identifier('homepage_url'), '/home')
  self.configurations << configuration
  self.save
end

#should_generate_new_friendly_id?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'app/models/website.rb', line 26

def should_generate_new_friendly_id?
  new_record? and self.internal_identifier.nil?
end

#to_data_hashObject



391
392
393
394
# File 'app/models/website.rb', line 391

def to_data_hash
  to_hash(only: [:id, :name, :title, :subtitle,
                 :internal_identifier, :created_at, :updated_at])
end

#to_labelObject



98
99
100
# File 'app/models/website.rb', line 98

def to_label
  self.name
end

#website_role_iidObject



387
388
389
# File 'app/models/website.rb', line 387

def website_role_iid
  "website_#{self.iid}_access"
end