I have a model User that has_one user_profile and a User_Profile belongs_to user
in the User controller I have:
def personal
@user = User.find_by_id(params[:id])
@user_profile = @user.user_profile
@user_profile ||= @user.build_user_profile
end
def update_personal
@user = User.find_by_id(params[:id])
if @user.user_profile.update_attributes(params[:user_profile])
flash[:notice] = "OK"
redirect_to @user
else
flash[:notice] = "Fail"
render :action => 'update_personal'
end
end
In my personal.html.erb view I have:
<% semantic_form_for @user_profile, :url => { :action => "update_personal"} do |form| %>
<%= form.inputs %>
<%= form.buttons %>
<%end%>
And on the rountes I have:
map.resources :users, :member => {
:personal => :get,
:update_personal => :put
}
Now the strange thing is that I can do:
users/1/personal
to see the form but when I submit I get this error:
Unknown action
No action responded to 1.
It's trying to find an action with the name 1.
Can anyone point me out on the right direction?