Skip to content

Commit

Permalink
fix render field for existing records, it wasn't loading the record
Browse files Browse the repository at this point in the history
  • Loading branch information
scambra committed Mar 9, 2012
1 parent b81585d commit b1a541e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/active_scaffold/actions/core.rb
Expand Up @@ -36,15 +36,17 @@ def render_field_for_update_columns
@scope = params[:scope]

if column.send_form_on_update_column
hash = if @scope
@scope.gsub('[','').split(']').inject(params[:record]) do |hash, index|
if @scope
hash = @scope.gsub('[','').split(']').inject(params[:record]) do |hash, index|
hash[index]
end
id = hash[:id]
else
params[:record]
hash = params[:record]
id = params[:id]
end
@record = hash[:id] ? find_if_allowed(hash[:id], :update) : new_model
@record = update_record_from_params(@record, active_scaffold_config.send(@scope ? :subform : (params[:id] ? :update : :create)).columns, hash)
@record = id ? find_if_allowed(id, :update) : new_model
@record = update_record_from_params(@record, active_scaffold_config.send(@scope ? :subform : (id ? :update : :create)).columns, hash)
else
@record = new_model
value = column_value_from_param_value(@record, column, params[:value])
Expand Down

0 comments on commit b1a541e

Please sign in to comment.