joelmoss / dynamic_form Goto Github PK
View Code? Open in Web Editor NEWThis project forked from rails/dynamic_form
Helpers to deal with your model backed forms in Rails3
Home Page: http://developwithstyle.com/dynamic_form/
License: MIT License
This project forked from rails/dynamic_form
Helpers to deal with your model backed forms in Rails3
Home Page: http://developwithstyle.com/dynamic_form/
License: MIT License
For example, if you don't want to show "login invalid" or "password invalid" but you would like to show "Account not activated" ...?
Not really an issue as I solved it, but something to note for other users of dynamic_form
.
I was implementing dynamic_form
with a Plain Old Ruby Object that includes ActiveModel::Validations
, and was getting the error in the subject line when trying to use <%= f.error_messages %>
.
I didn't find any other instances of this issue, but it can be solved by defining to_model
in the PORO:
class Download
include ActiveModel::Validations
attr_accessor :name
validates_presence_of :name
def to_model
self
end
end
Thanks for the gem, works great.
displays as string, rather than rendered html:
I don't know at what point the form helper stopped working so I'm just going to say it doesn't work on 3.0.7 as that's the version I'm running on.
I have a nested model (although I tried this with a non-nested model and got the same problem) called Employer::Question
. I created a haml form for the new
view and called:
= form('question')
Reloading the page threw the error that Rails couldn't find the route :action => "employer/questions", :controller => "employer/questions"
.
I dug into the code some and it looks like the form
method is expecting url_for
to return the action name ("create" for example). But it's actually returning the path for the action ("employer/questions" in my case).
Changing the call to form_for
to:
contents = form_tag(action, :method =>(options[:method] || 'post'), :enctype => options[:multipart] ? 'multipart/form-data': nil)
seems to fix the problem but all the tests break because the overridden url_for
still returns the action. I don't know how to fix the tests so I haven't sent a pull request. I'm sorry for that.
I'm using error_messages_for on my forms but it's escaping the html like so: http://cl.ly/DlDN
This is the code I'm using:
<%= error_messages_for(:form, :user, :message => "<strong>Opps, it doesn't look like you filled everything out properly.</strong><br>
The fields marked in RED below must be filled out properly before you can continue.") %>
Anything I'm missing to get this to work properly? As you can see the input fields with the fieldWithErrors
is also escaping html for some reason.
Thanks!
Hi,
Is there a way to simply skip activerecord.errors.template.header
, activerecord.errors.template.header.body
and display only error messages with f.error_messages
?
I have been trying to shorten my Rails app startup times, so I benchmarked the gem requirement times using the trick described at http://stackoverflow.com/questions/9505612/slow-loading-time-for-rails-3-2-debug-shows-rails-loading-twice.
I found dynamic_form to be the slowest-loading gem next to Devise (which notoriously slow-loading).
Any idea why the loading of dynamic_form is so slow and how to speed it up?
never mind
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.