Ruby on Rails Wednesday, January 27, 2016

Hello,

I am trying to disable chrome HTML5 validations by setting the
novalidate attribute.

form_for(:customer, url: {:action => 'update', :id => @customer.id,
:account_settings => true},:html => {:novalidate => 'novalidate'}) do
|f|
= render(:partial => 'form', :locals => {:f => f})

But when the form renders in chrome it does not show up.
<input class="form-control" id="customer_contact_email"
name="customer[contact_email]" pattern="false" type="email">

And the validations stop me from submitting the form.
Thank you,

Mendel.

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/07efa655bfc8eced70a8ab648bda16db%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails


Hi there,

What is the usual way to let a user modify his own data and the admin to
edit and view the data of all users.

I could do:

1) create a Person model with a route
resources :people

that works fine, if I check the permissions for :admin and non admin
accounts.

but for a user I have the /person/334/edit route.  But for the user
which is not an admin, I'd like not to have this id in the route.

so I

2) routed like this:

namespace :admin do
    resources :people
end
namespace :user do
    resoures :people
end

but then I have two controllers, can I put this together as one?

and another problem:  there is no redirect_to @person , which is also
bad, maybe I could get it work in the model, checking if an admin or a
user should be redirected to @person.

What is the usual way to fix the user edits his own, and the admin edits
all data?

Thanks,
Martin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/4e4ba33a-b8fb-4f0c-8b11-9970b04b197b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

You can put like this

before_action check_something_with_redirect_if_any, except: [all actions except index]

but its very verbose :D

On Thu, Jan 28, 2016 at 12:43 AM, Martin <mylists@kaffanke.at> wrote:
Hi there,

If I want a before_action for only one action, like

before_action check_something_with_redirect_if_any, only: :index

Is there another way doing that? Or is this the recommend way?

If not what else could work here?

Thanks,
Martin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/2d11149f-2cba-4809-b769-ee9604636c11%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAJR%2B9kbuD0%3D3rNpErnk5yijp5CQ%3D8vYt7%3DiT%2BAys3ymeaHUD1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.