[yast-devel] user form problem and other cleanups
The form now works:
form_for(:user, @user, :url => { :action => "update" }, :html => {
:method => :put } ) do |f| %>
Rails was right, the route is configured to do a put, and to get the
put, one needs to put it into the :html option.
That together with changing YaST::ServiceResource to actually use simple
class names solves the problem.
( now org.yast.foo is no longer
YaST::ServiceResource::Proxies::OrgYaSTFoo but only
YaST::ServiceResource::Proxies::Foo ) and then we will add a feature to
request the proxy with a custom class name in case you need to handle
resources named equal.
I may had broke sshkeys.
Some things that can be improved (not necessarily for the milestone):
- When one uses form_for, rails generates for fields with
name="modelname[atrrname] instead of name="attrname".
so making
@user.attrname = params[:user][:attrname] for every attribute is not needed.
as params[:user] is already a Hash with all the values, you can init the
model with the hash values:
require 'active_resource'
class Resource < ActiveResource::Base
self.site = "http://localhost:8080"
end
r = Resource.new(:a => "foo", :b => "kfk")
=> #
participants (1)
-
Duncan Mac-Vicar Prett