Added extra params to Clients API:

This commit is contained in:
Saurabh Bhatia 2014-02-18 17:06:53 +08:00
parent 349ccd3af9
commit a1b087a584
3 changed files with 12 additions and 4 deletions

View File

@ -6,12 +6,12 @@ module Api
def create
respond_with Client.create(client_params)
end
private
# Never trust parameters from the scary internet, only allow the white list through.
def client_params
params.require(:client).permit(:site_name, :site_token, :site_id)
params.require(:client).permit(:site_name, :site_token, :site_id, :university, :department, :email, :country, :url)
end
end
end

View File

@ -3,7 +3,12 @@ class Client
field :site_name, type: String
field :site_token, type: String
field :site_id, type: String
field :university, type: String
field :department, type: String
field :email, type: String
field :country, type: String
field :url, type: String
validates :site_id, :uniqueness => true
validates :site_token, :uniqueness => true
end
end

View File

@ -12,7 +12,8 @@ Mtstore::Application.configure do
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.action_mailer.perform_deliveries = true
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
@ -24,4 +25,6 @@ Mtstore::Application.configure do
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 }
end