Show More
Commit Description:
change find(:xxx) to correct syntax for rails 4
Commit Description:
change find(:xxx) to correct syntax for rails 4
References:
File last commit:
Show/Diff file:
Action:
app/controllers/configurations_controller.rb
| 34 lines
| 1004 B
| text/x-ruby
| RubyLexer
|
|
r76 | class ConfigurationsController < ApplicationController | ||
before_filter :authenticate | ||||
before_filter { |controller| controller.authorization_by_roles(['admin'])} | ||||
def index | ||||
r619 | @configurations = GraderConfiguration.order(:key) | |||
r613 | @group = GraderConfiguration.pluck("grader_configurations.key").map{ |x| x[0...(x.index('.'))] }.uniq.sort | |||
|
r76 | end | ||
def reload | ||||
|
r320 | GraderConfiguration.reload | ||
|
r76 | redirect_to :action => 'index' | ||
end | ||||
r474 | def update | |||
@config = GraderConfiguration.find(params[:id]) | ||||
r531 | User.clear_last_login if @config.key == GraderConfiguration::MULTIPLE_IP_LOGIN_KEY and @config.value == 'true' and params[:grader_configuration][:value] == 'false' | |||
r474 | respond_to do |format| | |||
r617 | if @config.update_attributes(configuration_params) | |||
r474 | format.json { head :ok } | |||
else | ||||
format.json { respond_with_bip(@config) } | ||||
end | ||||
end | ||||
end | ||||
r617 | private | |||
def configuration_params | ||||
params.require(:grader_configuration).permit(:key,:value_type,:value,:description) | ||||
end | ||||
|
r76 | end | ||