Class: Cheat::Controllers::Edit

Inherits:
R
  • Object
show all
Defined in:
lib/cheat/site.rb

Instance Method Summary collapse

Instance Method Details

#get(title, version = nil) ⇒ Object



119
120
121
122
123
124
125
126
127
# File 'lib/cheat/site.rb', line 119

def get(title, version = nil)
  @sheet = Sheet.detect { |s| s.title == title }

  @error = "Cheat sheet not found." unless @sheet
  unless version.nil? || version == @sheet.version.to_s
    @sheet = @sheet.find_version(version)
  end
  render @error ? :error : :edit
end