I should be checking can_create? on a new record so it should render
blank if create is not permitted.

elsif action == "new"
  # Link to a new object form
  new_record = target.new
  new_record.set_creator(current_user)
  href = object_url(target, "new", params._?.merge(:subsite =>
subsite))

  if href && (force || can_create?(new_record))
    new_class_name = if target.respond_to?(:proxy_reflection)
        target.proxy_reflection.klass.name
      else
        target.name
    end

    add_classes!(attributes, "new-#{new_class_name.underscore}-link")
    content = "New #{new_class_name.titleize}" if content.blank?
    Hobo::Dryml.last_if = true
    element(:a, attributes.update(:href => href), content)
  else
    Hobo::Dryml.last_if = false
    ""
  end
else ...

Might want to check what can_create? shows on a new model.

On Aug 1, 3:01 pm, Nicolas Oury <[email protected]> wrote:
> Dear all,
>
> after a few experiments in my skecthy application, it seems to me that
> <a action="new"> does not call
> after_user_new to check the permission before putting a link or not.
>
> Is it the right behavior or a bug in my app?
> What is the right idiom for <a action="new"> on models that need
> after_user_new to pass create_permitted?
>
> Best regards,
>
> Nicolas.

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to