Module: CRUD::Base
- Defined in:
- lib/rails-crud/base.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
3 4 5 |
# File 'lib/rails-crud/base.rb', line 3 def self.included(base) base.send :include, ClassMethods end |
Instance Method Details
#create ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/rails-crud/base.rb', line 34 def create run_callbacks(:before_save) if get_model_variable.save redirect_to :action => :index and return else crud_render :new end end |
#destroy ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/rails-crud/base.rb', line 56 def destroy if get_model_variable.destroy redirect_to :action => :index and return else crud_render :index end end |
#edit ⇒ Object
30 31 32 |
# File 'lib/rails-crud/base.rb', line 30 def edit crud_render end |
#index ⇒ Object
24 25 26 |
# File 'lib/rails-crud/base.rb', line 24 def index; crud_render end |
#new ⇒ Object
27 28 29 |
# File 'lib/rails-crud/base.rb', line 27 def new; crud_render end |
#update ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/rails-crud/base.rb', line 44 def update get_model_variable.attributes = params[param_key] run_callbacks(:before_save) if get_model_variable.save redirect_to :action => :index and return else crud_render :edit end end |