Class: Marcation

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
ActiveModel::Naming
Defined in:
app/models/marcation.rb

Defined Under Namespace

Classes: Translation

Instance Method Summary collapse

Instance Method Details

#as_json(options) ⇒ Object

include ActionView::Helpers::NumberHelper



27
28
29
30
31
32
33
34
35
36
37
# File 'app/models/marcation.rb', line 27

def as_json options
  # if can? :update, self
    super.merge!(
      path: {
        show: tour_marcation_path(self.tour, self),
        edit: edit_tour_marcation_path(self.tour, self)
      })
  # else
  #   super
  # end
end

#translations_attributes=(attributes) ⇒ Object



16
17
18
19
20
21
# File 'app/models/marcation.rb', line 16

def translations_attributes=(attributes)
  new_translations = attributes.values.reduce({}) do |new_values, translation|
    new_values.merge! translation.delete("locale") => translation
  end
  set_translations new_translations
end