Sha256: 4c0b2d7324e771fe3d4eba3daecfb42a0087ae358787b5f6e4018825be2516bd

Contents?: true

Size: 963 Bytes

Versions: 4

Compression:

Stored size: 963 Bytes

Contents

class <%=short_message_model_name.pluralize%>Controller < ApplicationController
  
  def index
    @<%=short_message_model_name.underscore.pluralize%> = ShortMessage.all
  end

  def new
    @<%=short_message_model_name.underscore%> = ShortMessage.new
  end
  
  def create
    @<%=short_message_model_name.underscore%> = ShortMessage.new(params[:short_message])
    
    respond_to do |format|
      if @<%=short_message_model_name.underscore%>.send_message
        flash[:notice] = '<%=short_message_model_name%> was successfully sent.'
        format.html { redirect_to(:action => 'index') }
        format.xml { render :xml => @<%=short_message_model_name.underscore%>, :status => :created, :location => @<%=short_message_model_name.underscore%> }
      else
        format.html { render :action => "new" }
        format.xml { render :xml => @<%=short_message_model_name.underscore%>.errors, :status => :unprocessable_entity }
      end
    end
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jnstq-acts_as_sms-0.1.0 rails_generators/short_message_service/templates/short_messages_controller.rb
jnstq-acts_as_sms-0.1.1 rails_generators/short_message_service/templates/short_messages_controller.rb
jnstq-acts_as_sms-0.1.3 rails_generators/short_message_service/templates/short_messages_controller.rb
jnstq-acts_as_sms-0.1.4 rails_generators/short_message_service/templates/short_messages_controller.rb