Class: Ishapi::AddressesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Ishapi::AddressesController
- Defined in:
- app/controllers/ishapi/addresses_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
#home, #long_term_token, #vote
Instance Method Details
#create ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/ishapi/addresses_controller.rb', line 7 def create if @current_profile.addresses.length == 0 @address = CoTailors::Address.new({ :profile_id => @current_profile.id }) else @address = @current_profile.addresses[0] end :update, @address flag = @address.update_attributes( params[:address].permit(:name, :phone, :address_1, :address_2, :city, :state, :zipcode ) ) if flag render :json => { :status => :ok, :message => 'Successfully put an address.' } else render :json => { :status => :not_ok, :error => @address.errors. } end end |