Module: Ruhl::Rails::ActiveRecord

Included in:
Presenter
Defined in:
lib/ruhl/rails/active_record.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) define_paths(model)



13
14
15
16
17
18
19
20
21
# File 'lib/ruhl/rails/active_record.rb', line 13

def define_paths(model)
  define_action(model, 'show')                      # show_path(@user)
  define_action(model, 'update')                    # update_path(@user)
  define_action(model, 'delete')                    # delete_path(@user)
  define_action("edit_#{model}", 'edit')            # edit_path(@user)
  define_action(model.pluralize, 'index', false)    # index_path
  define_action(model.pluralize, 'create', false)   # create_path
  define_action("new_#{model}", 'new', false)       # new_path
end

- (Object) error_messages



8
9
10
11
# File 'lib/ruhl/rails/active_record.rb', line 8

def error_messages
  return if presentee.errors.empty?
  presentee.errors.full_messages
end

- (Boolean) error_messages?

Returns:

  • (Boolean)


4
5
6
# File 'lib/ruhl/rails/active_record.rb', line 4

def error_messages?
  !presentee.errors.empty?
end