Displaying 20 results from an estimated 6000 matches similar to: "form builder"
2007 Nov 28
3
overriding rest show route but not delete
hi, lets say routes.rb has
map.resources :foo
and I want the show action to have a diffent url, so I add (after the
above line)
map.foo ''/bar/:id'', :controller => ''foo'', :action => ''show''
this works fine, including foo_path( :id => "1") => /bar/1
and <%= link_to ''Show'', foo %>
2008 Nov 05
1
ambiguous nested conditions on find
Hi, i''m trying to figure out how to do a query with an ambiguous
condition
Lets say Comment belongs_to :article and :user,
and Article :belongs_to :user
How can I find the comments by one user on articles by another user
in one query?
This doesnt work, but is kind of the idea:
Comment.find :all, :conditions => {''users.name'' =>
2010 Jul 26
1
form date helper with text year
I have a date where the year range is more then I want to define in a
select_date scaffold generated year range.
My idea was to have the year entered as a text field and the month and
day using something like:
<%= select_month @person.born,:prefix => :person ,:field_name =>
"born(2i)" %>
<%= select_day @person.born,:prefix => :person , :field_name =>
2007 Feb 27
2
Dynamically add radio buttons to forms?
Good afternoon all
I''m trying to implement a form that dynamically inserts radio buttons
into a form. The user selects options from a drop-down menu. I use
observe_field to watch for a change and call back to render the
appropriate partial tha contains the radio options. All works nicely
but I''m tripped up on one thing:
When rendering a form using form_for how do I link those
2006 Feb 26
2
howto keep already entered form fields
Hi,
is there a way to keep the already entered form fields when the form is
re-displayed after some error has been detected and reported to the user
via flash?
Regards
IJD
--
Posted via http://www.ruby-forum.com/.
2007 Jul 31
11
helper spec not finding rails core helpers
Hi,
My helper specs were going ok until I added a call to a rails
DateHelper method in one of my helpers
http://api.rubyonrails.com/classes/ActionView/Helpers/
DateHelper.html#M000574
The helper runs fine from my view templates, just dies in the spec test.
I boiled my question down to a simple (not too useful) example. I''m
not sure what I''m missing.
#
2006 Jun 26
2
DRY up selects in view
Here''s what I''ve got:
<% @fields.each do |field_name| %>
<tr>
<td>
<%= field_name.humanize %>
</td>
<td>
<% unless field_name =~ /_id$/ %>
<%= form.text_field field_name, :size => 40 %>
<% else %>
<%= select(:vendor,
field_name,
State.find(:all, :order
2007 Nov 20
4
cap deploy:spec
fyi, I just posted this
http://www.vaporbase.com/postings/Running_rspec_after_you_deploy
- linoj
2007 Oct 29
7
rake spec default environment
hi,
When I run rake spec , it seems to be starting with my default
environment (development or production) and connects to that
database, before actually connecting to the test one and proceeding
with the tests. When I remove the development database, the specs
wont run. How do i initiate rspec to be test environment from the
start? I dont see this when i run using script/spec
linoj
2006 Nov 02
5
Adding fields to a form
Is there a decent way to add a field to a form before posting it? I
haven''t tried using HPricot manipulations just yet, since I can''t
ever find really solid docs on hpricot....
Form#[]= doesn''t work because it first searches only pre-existing
fields. I''m investigating how to write a patch now.
But I thought maybe someone here might have an idea.
2007 Oct 26
2
rspec and capistrano
Hi,
has anyone here written a capistrano task for rspec to run through my
specs on the deployed server? I''d appreciate a snippet or two to get
me started.
Thx
linoj
2007 May 30
2
should_eql etc?
Hi, I''m trying the specs for restful_authentication I found here
http://jonathan.tron.name/articles/2007/01/02/rspec-on-rails-restful-
authentication
It seems to use custom .should methods: should_eql,
should_be_an_instance_of, should_redirect_to, should_be_success,
should_not_be_nil, should_be_nil, should_not_be_nil, should_be_empty,
should_be_success, should_not_change, and
2007 May 23
3
log file
hi,
When running rails spec tests is there a log file generated? i''m
looking for generated sql to help me debug like in development.log
or is there a way to run the test against a webrick server so i can
see logs?
(i''m not running with spec_server at the moment, it doesnt seem to
work well with autotest)
thanks
linoj
2009 Feb 05
1
[rspec] [rails] Specing a form builder
I''m trying to set up and run a new form builder under rails, which lives
under the helpers directory, but isn''t really a helper. (Not a module, so
doesn''t mix in well)
Short of dropping down into a view spec, how do I set up to actually spec
the form builder?
describe RandomFormBuilder do
attr_reader :builder
before do
@object = mock_model(Foo)
@builder =
2010 May 28
8
form helpers don't seem to work with RJS files...
I’ve been spending a great deal of time chasing this problem. Hopefully
someone sees something obvious I’m doing wrong. Basically anytime I try
to call fields_for from an RJS file or within a partial in the RJS file,
I get the following error. My goal is simply to load a partial into a
div. The fields in this partial require fields_for though. And that’s
where the problem lies.
2007 May 25
4
rspec on rails update question
I''m sure this is OT but I''d appreciate the help
I''m using rspec_on_rails
I prefer to use stable release rather than live dangerously (at least
until I can tell the difference between what I might be doing wrong
vs problems in rspec). However, I would like to try the
RspecScaffoldGenerator fix.
I installed (per the docs) last week with the following commands
2006 Jul 26
2
text_field and date_select in collection
hello,
i would like to display a collection of records on one page (e.g. an
author record with all his/her books).
a record contains a text_area (e.g. a description of the book) and a
date_select (e.g. when the book was published).
<% for @book in @author.books %>
<%= text_area ''book[]'', ''note'' %>
<%= datetime_select
2008 Mar 19
2
rescue
Hi, whats the correct way to spec a rescue? This will raise it but
doesnt test my code''s response
# controller
def edit
@foo = Foo.find(params[:id])
rescue
flash[:notice] = "Unknown foo #{params[:id]}"
redirect_to foos_path
end
# spec
it "should flash error if not found" do
Foo.should_receive(:find).and_raise
get :edit, :id
2007 Oct 02
1
flash in story runner
hi,
is there a way to assert a flash message directly in story runner? Or
do I have to go through the response text instead.
Then "flash message should say success" do
#flash[:notice].should == "User successfully invited"
response.should have_text(/User successfully invited/)
end
linoj
2007 Dec 20
1
link to lighthouse?
fyi, there doesnt seem to be a link to rspec.lighthouse.com from the
new web site (unless I missed it). I guess I expected it under
"Community"
linoj