-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refinery::Admin::PagesController#update error #2487
Comments
Hmm, thanks. Could you help us by contributing a failing test case for this? Otherwise, if someone else wants to then great! Or, I'll get to it in a while. :-) |
I get the same error in refinerycms 2.1.0 and with one or more locales defined. |
You'd have to clone the repository and run bundle exec rspec pages/spec Or, do you mean within the context of your application? |
Ok thx. No I meant within the context of the cms itself. |
I cloned the refinerycms repository as you said.
causes following error:
|
First you have to install the dummy application http://refinerycms.com/guides/contributing-to-refinery#setup bundle exec rake refinery:testing:dummy_app |
ah okay, now I have the setup I need :). Fresh clone: Finished in 1 minute 52.7 seconds a bit random? :) But anyway, I´ll try to get a failing test for my scenario - and a possible fix also. |
Yeah, currently we have set |
hmm, I can´t reproduce my error. |
@mattherick any luck reproducing? |
Nope. I fixed it through a before filter: before_filter :title_check, :only => [:update]
private
def title_check
if params[:page][:title].blank?
@page.errors.add(:title, I18n.t("errors.messages.blank"))
@page.title = ""
render "edit"
end
end But I don't know why this happens.. |
After reading your code again, I'm taking back what I said about it being dangerous, I see that you're bouncing the user back to the edit template. When they submit this a second time, do you get the same problem again? |
If the title is blank and they submit.. the edit template will be rendered again.. second time, third time, fourth time..always the same behavior. So yes, I always have the same problem. |
Can't you prevent this with: validates :title, presence: true I'm very surprised that it's not being caught by our own validation |
no, it´s weird. |
I'm having this very same issue. Any progress so far with this issue? |
If I update an existing page and leave the title blank i get following error:
I use refinerycms 2.1.1
The text was updated successfully, but these errors were encountered: