Module: Ramaze::Helper::Section
- Defined in:
- lib/zen/package/sections/lib/sections/helper/section.rb
Overview
Helper for the sections package.
Instance Method Summary (collapse)
-
- (Sections::Model::Section) validate_section(section_id)
Validates the section ID and returns the section if it's valid.
-
- (Sections::Model::SectionEntry) validate_section_entry(section_entry_id, section_id)
Validates a section entry and returns it if it's valid.
Instance Method Details
- (Sections::Model::Section) validate_section(section_id)
Validates the section ID and returns the section if it's valid.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/zen/package/sections/lib/sections/helper/section.rb', line 16 def validate_section(section_id) section = Sections::Model::Section[section_id] if section.nil? (:error, lang('sections.errors.invalid_section')) redirect(Sections::Controller::Sections.r(:index)) else return section end end |
- (Sections::Model::SectionEntry) validate_section_entry(section_entry_id, section_id)
Validates a section entry and returns it if it's valid.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/zen/package/sections/lib/sections/helper/section.rb', line 38 def validate_section_entry(section_entry_id, section_id) entry = Sections::Model::SectionEntry[section_entry_id] if entry.nil? (:error, lang('section_entries.errors.invalid_entry')) redirect(Sections::Controller::SectionEntries.r(:index, section_id)) else return entry end end |