You can add autorized methods to your model:

# forbid update action for each record, update link not displayed
def self.authorized_for_update?
  false
end

def authorized_for_update?
  false
end

def mycolumn_authorized_for_update?\
  true
end

El jueves, 5 de enero de 2017 16:48:11 (CET) Benjamín Cárdenas Salamandra 
escribió:
> El 04-01-2017 a las 10:41, Sergio Cambra escribió:
> El miércoles, 4 de enero de 2017 5:21:13 (CET) bencarsal escribió:
> Esteemed group,
> 
> I try to implement the inplace_edit thereby:
> in the controller:
> ....
> config.columns[:mycolumn].form_ui = :select
> config.columns[:mycolumn].options = {:options => [['SI', 'S'], ['NO', 'N']]}
> config.columns[:mycolumn].inplace_edit = true
> config.columns[:mycolumn].inplace_edit_update = :columns
> config.columns[:mycolumn].update_columns = :mycolumn
> ....
> 
> But when i use this option in the list, show this error:
> 
> Started POST
> "/my_controller/13919/update_column?column=mycolumn&eid=a079cfec5b2b6568bab3
> 486756298205" for 0:0:0:0:0:0:0:1 at 2017-01-04 10:04:42 -0300
> Processing by MyControllerController#update_column as JS
>   Parameters: {"value"=>"S",
> "editor_id"=>"as_a079cfec5b2b6568bab3486756298205-update_column-13919-mycolu
> mn-cell", "authenticity_token"=>"iqmthNcuOyP3VdaIhJW8rBaTNO8U5cljbmwmoTE
> 0hI=", "eid"=>"a079cfec5b2b6568bab3486756298205", "original_html"=>"NO",
> "original_value"=>"NO", "column"=>"mycolumn", "id"=>"13919"}
>   User Load (1.0ms)  SELECT  "users".* FROM "users"  WHERE "users"."id" =
> 63  ORDER BY "users"."id" ASC LIMIT 1
>   Rendered
> C:/transito/torquebox/jruby/lib/ruby/gems/shared/bundler/gems/active_scaffol
> d-0fa23f678c48/app/views/active_scaffold_overrides/update_column.js.erb
> (292.0ms)
> Completed 500 Internal Server Error in 993ms
> 
> ActionView::Template::Error (undefined method `id' for nil:NilClass):
>     1: <% @column_span_id ||= element_cell_id(:id => @record.id.to_s,
> 
> :action => 'update_column', :name => @column.name) -%>
> 
>     2: <% unless successful? -%>
>     3:   alert('<%=
> escape_javascript(@record.errors.full_messages.join("\n")) %>');
>     4:   <% @record.reload -%>
> 
> What could be the problem?
> 
> thanks for your help,
> 
> Benjamín
> I don't see any query loading record for 'my_controller', so @record must be
> nil, and you get undefined method `id' for nil:NilClass in first line of
> update_column.js.erb
> 
> Maybe you have some before_action or before_filter preventing to run
> active_scaffold action method.
> 
> Esteemed Sergio, the error was because i have this line in the controller:
> 
> config.actions.exclude :create, :delete, :update
> 
> The action :update was necessary for inplace_edit normal functionality. I
> need retrict this action anyway, therefore I will investigate how to do it.
> 
> Thanks a lot.
> 
> Benjamín
> --
> You received this message because you are subscribed to the Google Groups
> "ActiveScaffold : Ruby on Rails Gem" group. To unsubscribe from this group
> and stop receiving emails from it, send an email to
> [email protected]. To post to this group, send
> email to [email protected]. Visit this group at
> https://groups.google.com/group/activescaffold. For more options, visit
> https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/activescaffold.
For more options, visit https://groups.google.com/d/optout.

Reply via email to