Displaying 20 results from an estimated 7000 matches similar to: "validates_acceptance_of (and hidden input)"
2006 Apr 27
1
validates_acceptance_of, virtual attributes and mass assign
Hi,
I''ve a question concerning validates_acceptance_of method.
Documentation says that the validated attribute is a virtual one,
without a field in db. But when I add such an attribute to my form (say
check_box(:xyz, :agreement)), it''s passed in params[:xyz][:agreement],
but not assigned when calling Xyz.new(params[:xyz]), probably because
corresponding field
2006 Jul 21
1
validates_acceptance_of weirdness
On my registration form I have a checkbox for a waiver. In the model I
have the statement:
validates_acceptance_of :waiver, :on => :create, :message => "must be
accepted"
In the view:
<%= check_box_tag("waiver") %>
<%= error_message_on "user", "waiver", "Waiver "%>
For some reason validate is accepting everything when the
2006 Feb 08
5
validates_acceptance_of + functional testing
I had to add a check box indicating that a user accepted certain terms
to a page. So, I put in a ''validates_acceptance_of :terms'' line into
the appropriate model and added a checkbox to my view. Everything
works as expected in my web browser.
However, my functional tests still pass and I didn''t add or change
anything to them. I was expecting to have to add another
2006 Oct 04
0
Displaying validates_acceptance_of Errors In A Check Box
Hello,
I am having trouble displaying a check box which must be checked but
hasn''t been. I would like it to be highlighted as in a scaffolded
view but the hidden check box field which is generated by the
check_box helper is also highlighted, and the text next to it loses
its styling.
My code follows. Should I get cleverer with the CSS or write my own
check_box helper which
2006 Apr 07
0
validates_acceptance_of problem
I''m having some difficulties getting validates_acceptance_of to work.
No matter whether I tick the checkbox for my terms and conditions on
my form, it will not submit it and shows my error message.
in my model i have:
validates_acceptance_of :agree_to_terms, :message => ""
in my view i have:
<%= error_message_on :user, :agree_to_terms, "You must agree to the
2007 Nov 25
4
is notify resevered word?
Hi,
When I added this association...
class User < ActiveRecord::Base
has_one :notify
end
...and tried then to update column in User table it will call queries
for notify table automatic?
Output
---------------------------------------------------------------
User Columns (0.041488) SHOW FIELDS FROM `users`
User Load (0.001544) SELECT * FROM `users` WHERE (`users`.`nickname`
=
2007 Nov 01
3
autotest debugger?
Hi,
I keep facing problems with autotest, and I don''t know what''s happening
in the background, is there anyway to know what''s happening while
testing?
Example:
@user = User.new
@user.email = "testcom"
@user.errors.on(:email).should_not be_empty
...throws error failure
- You have a nil object when you didn''t expect it!
- You might have expected an
2006 Apr 04
6
check_box_tag is limited?
Hello all.
Am I going totally nuts here and just want to check (Natch!) something.
A normal check_box has two value posssibilities. One for checked and one
for unchecked, the value gets submitted with a form.
The check_box_tag on the other hand, has a checked_value (Called just
''value'') and for the unchecked value...nothing, zip, nada.
This means that if you submit a form with
2007 May 06
2
render :action "call method first?"
Hi,
I know when I call:
render :controller => ''some'', :action => ''thing''
It doesn''t call the method ''thing'' before render the template
''thing.rhtml'', but I need some instance variable which are in the
''thing'' method, how can I let it call the method ''thing'' and then render
2010 Sep 09
17
formtastic issue
Hello,
I will try to explain it step by step :-)
I just created a new rails 3 app, then I created a new controller...
rails generate controller admin::users
I didn''t forget to add the resources in the routes.rb file like this.
namespace :admin do
resources :users
end
Now I try to use formtastic to create the form but I get erorr that my
users_path doesn''t exist?
2006 Jul 03
9
checkboxes
in the mean time i am using a checkbox like this :
<input type="checkbox" name="var[car]" <%= var.car ? ''checked'' : ''''
unless @var == nil %> />
but i am sure there is something better than this in rails like
<%= checkbox_tag ''var'', ''car'', :checked => true %>
but this is not
2007 Mar 27
6
how does rails do this "find_by_?"
Hello there,
I''m wondering how do they create functions on the fly?
find_by_any_column_name ??
I want to do something similar with my models, but I don''t really know
how to do it?
user_current_nickname
user_current_id
user_current_role
etc.?
Regards,
Jamal
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this
2007 Oct 02
3
Note on Rails 2.0 Preview
Make sure you get a relatively current version of rspec or you will get:
/Users/me/rails/ubb/vendor/rails/activerecord/lib/../../activesupport/
lib/active_support/dependencies.rb:263:in `load_missing_constant'':
uninitialized constant ActionView::Helpers::JavaScriptMacrosHelper
(NameError)
Hope this helps someone.
2006 Jul 19
6
Howto: Check_box with a variable (no model)
Hi,
I would like to put a checkbox on a form where the input field is a
variable rather than a field in a model.
The normal way (with a model) would be:
<%= check_box(''client'', ''accept'', {}, "1", "0") %>
But since accept is a variable @accept and model client will not be
there, how do I make a check box work?
Regards,
Paul
2007 Mar 30
10
check_box_tag not passing 0 when unchecked?
Code:
<%= check_box_tag("person[#{person.id}][is_approved]", 1, true) %>
Rendered output:
<input checked="checked" id="person[7][is_approved]"
name="person[7][is_approved]" value="1" type="checkbox">
Problem:
The value of "1" is always passed, even if the box is UNCHECKED.
Suggestions? Thanks!
--
Posted via
2007 Apr 16
6
How to use a form.check_box ?
Hey guys,
I''m trying to have a simple webform in my administration section to
add a user. I have the text_fields for adding the user''s name,
password, and password confirmation, but cannot seem to figure out the
checkbox. I want it to be a single checkbox, that if clicked, will set
the database column "access" to be "admin" and if its unchecked, set
it to be
2007 Sep 07
5
enforce mutual exclusivity
Hi,
First post, please be gentle! I couldn''t find any mention of this
already
I''m using ActiveRecord and I want to enforce mutual exclusivity on a
has_and_belongs_to_many.
A concrete example: I have a User which can have one or more Roles
(student, tutor, headmaster, administrator etc). However if a user is
a
student they cannot hold any other role. I was hoping to find
2006 Apr 25
3
Simple Rails Question
Hi, I have a few simple rails questions:
Does the check_box_tag map to an int or to a boolean field within the
database?
Thanks in advance,
-Conrad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060425/4956dc68/attachment.html
2007 Apr 12
4
Installing rspec in Windows
Hi all,
I''m trying to install rspec and I''m having a problem.
C:\Users\Nathan\Documents\rails\myproject> gem install rspec
Bulk updating Gem source index for: http://gems.rubyforge.org
Successfully installed rspec-0.8.2
Installing ri documentation for rspec-0.8.2...
Installing RDoc documentation for rspec-0.8.2...
C:\Users\Nathan\Documents\rails\myproject> ruby
2007 Mar 29
4
validates_length_of not working with :if ?
Hello,
I''m trying to cut down the errors if the guy already getting the empty
nickname, so he doesn''t get anything about the nickname is short.
validates_presence_of :nickname
This below is not working ?
validates_length_of :nickname, :within => 4..40, :if => Proc.new {
|user| user.nickname.length > 1 }
nor this one below?
validates_length_of :nickname, :within