class Object
Public Class Methods
new(<%= file_name.downcase.underscore %>) self.client = super self.<%= file_name.downcase.underscore %> = <%= file_name.downcase.underscore %> end def send(message) msg = client.put("<%= file_name.downcase.underscore %>s/
click to toggle source
# File lib/generators/firebase/templates/firebase.rb, line 4 def initialize(<%= file_name.downcase.underscore %>) self.client = super self.<%= file_name.downcase.underscore %> = <%= file_name.downcase.underscore %> end def send(message) msg = client.put
Public Instance Methods
destroy()
click to toggle source
DELETE <%= route_url %>/1 DELETE <%= route_url %>/1.json
# File lib/generators/prefab/templates/lib/templates/rails/scaffold_controller/controller.rb, line 49 def destroy <%= orm_instance.destroy %> respond_to do |format| format.html { redirect_to <%= index_helper %>_url } format.json { head :no_content } end
to_s()
click to toggle source
# File lib/generators/prefab/templates/lib/templates/active_record/model/model.rb, line 17 def to_s <%- if attributes.map{ |a| a.name }.include?('name') -%> name <%- else -%> "<%= class_name %> #{id}" <%- end -%> end
update()
click to toggle source
# File lib/generators/prefab/templates/lib/templates/rails/scaffold_controller/controller.rb, line 35 def update respond_to do |format| if <%= orm_instance.update("#{singular_table_name}_params") %> format.html { redirect_to <%= singular_table_name %>, notice: <%= "'#{human_name} was successfully updated.'" %> } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: <%= "#{orm_instance.errors}" %>, status: ':unprocessable_entity' } end end end