Displaying 20 results from an estimated 2000 matches similar to: "Help with Forms"
2006 Apr 04
5
How to implement tag clouds using plugin?
The code on
http://blog.craz8.com/articles/2005/10/28/acts_as_taggable-is-a-cool-piece-of-code
is based on the acts_as_taggable gem,anybody has done that using the
acts_as_taggable plugin?thanks!
btw:the code above uses the tag_count method,which is defined in the
gem:
def tags_count(options = {})
options = {:order => ''count DESC''}.merge(options)
2006 Jun 02
4
Creating an array of params
I''ve got a bunch of text fields that I''d like to access as an array.
The code looks like this:
<%= text_field_tag "people[0][entry]" %>
<%= text_field_tag "people[1][entry]" %>
<%= text_field_tag "people[2][entry]" %>
So when I submit the form, I''d like to be able to use it like
params[:people].each {|p| p[:entry]}
2004 Oct 03
1
How might one write this better?
I am trying to simulate the trajectory of the pension assets of one
person. In C-like syntax, it looks like this:
daily.wage.growth = 1.001 # deterministic
contribution.rate = 0.08 # deterministic 8%
Wage = 10 # initial
Asset = 0 # initial
for (10,000 days) {
Asset += contribution.rate * Wage
2007 Mar 26
2
Failure creating model in spec setup not reported?
Hi
I''ve just tracked down a wierd error that AFAICT is caused by an
error not being raised in the setup:
context "An Asset" do
setup do
@provider = Provider.create(:name => "Provider1")
@product = Product.new(:name => "Product1", :provider =>
@provider)
@applicant = Applicant.new(:first_name =>
2006 Apr 24
2
Checkboxes - Saving a Checked record to another table
I am displaying a bunch of records from a table called "assets". Next
to each record i have a checkbox. When this box is checked i want to be
able to save the id of the record into another table called
"flagged_assets". All I need is the ID, nothing else. Im struggling
with the logic to save to another table. I know how to do it if the
asset_id is already in the
2006 Mar 23
1
Multiple file uploads
I have a form with multiple file upload fields (1-10), of which 2-10
are optional. So i need to cycle thru all file fields and pick only
those that have a file attached. Selecting only one file in the form,
the paramters look simple: "image"=>{"file_1"=>#<File:/tmp/CGI344.4>,
"file_2"=>"", "file_3"=>""}, so I
2005 Dec 01
2
View helpers and nested attributes
Hello all,
I have a model with two entities (document and asset) and a 1:1
relationship defined between them (every model has an asset).
I want to generate a rthml view that generates a hash for document
attributes and a nested hash for asset attributes (for example
{:document =>{:name=>XXX :asset => {date =>XXX}})
According to the Pragmatic Programmers book (page 355), the input
2006 Jan 18
22
Creating multiple child objects from the same form
I''ve been digging into rails, but this one question has been a two day
stumper. I''ve got a question/answer model that I''m trying to work out.
Each question has multiple answers (they''re more like choices, it
doesn''t matter whether they''re right or wrong), and I''d like to have the
question creation form also have multiple fields in
2006 Mar 08
19
Creating multiple rows with one form
Hello. I''ve been trying this out for the past two days and I can''t seem to
get it. I''m going to have a page where you can upload x amount of images at
once. Lets say 10 images need to be uploaded, all with a caption.
I''d like to have a browse button to choose the file, then the caption. Now,
if I put 10 of them in one form, fill them all out and submit, I get
2007 Jun 26
4
Can I stub a method on a belongs_to association:
describe Asset, " when destroyed" do
fixtures :assets, :videos, :sites, :publish_settings
before(:each) do
@asset = assets(:test_asset)
@mock_hook = mock("hook")
@asset.video.stub!(:hook).and_return @mock_hook # error occurs here
end
it "should call the delete hook" do
@mock_hook.should_receive(:update).with("test_video",
2005 Dec 02
3
Conceptual Design Question
Hi All,
I am making a DAM (seems to be the hip thing to do these days). It is
for the company that I work for. We have some really weird domain
rules that have prevented me from just using a simple directory
structure file permission system. I have come up with a solution but I
wanted to run it by you gurus to ensure that I am not recompiling the
wheel here.
Basically the domain rule is:
A user
2007 Mar 18
2
mongrel timing out
I am not sure when it exactly occurred but I have 2 servers I am about to
migrate to apache+mongrel from lighty+fastcgi
oddly, both my servers seemed to have died at the same time everytime I
restart within a 24 hr period ( I don''t know when, my logs don''t show it ).
Can someone please point me in the direction of what I need to do to trace
the cause of this. Or what you would
2012 Mar 20
4
Multiple Paperclip Images on Index
Hi,
I am working on a project that is using Paperclip to upload multiple
images to an Asset model. my Post model has_many Assets. As per this
tutorial/screencast...
https://github.com/Emerson/Multiple-File-Uploads-with-Paperclip-and-Rails-3/blob/master/app/views/posts/show.html.erb">
http://www.emersonlackey.com/article/paperclip-with-rails-3>
This all works fine and I can
2004 Feb 04
2
Syslinux using Asset Tag (from Dell or Compay) instead of MAC Adress
I am using PXELINUX to unattened install our machines with XP.
It is a not very easy to handle with mac adresses because mac
adresses can change when a motherboard is changed, but the asset tag
from dell (or also from compaq) will be also updated when the motherboard is
changed to the
original value, so our unique key here is the asset tag.
So my idea is to change the behaviour so that it will
2008 Jan 18
2
NameError when using alias_method -- but method exists?
Hello Rubyists,
I am a bit stumped here. I want to extend the ''load_file'' method in the
YAML module. Following along with the PickAxe example of making old
methods do new things, I try this in irb:
>> module YAML
>> alias_method :orig_load_f, :load_file
>> def load_file(*args)
>> contents = orig_load_f(*args)
>>
2007 Sep 06
4
HABTM association with own class?
If I have a class, Asset, which has and belongs to many associated Asset
objects, how do I do this?
has_and_belongs_to_many :associated_assets, :class => "Asset",
:foreign_key => ?????, :association_foreign_key => ?????
Right now, my table has a :first_asset_id and a :second_asset_id, but I
don''t see how the objects themselves are supposed to distinguish one
from the
2006 Apr 24
4
Joined search returns NIL ids
I have two models: assets and makes. Make has many assets and an asset
belongs to one make.
I am calling this part of my asset controller from a search form with
the parameters "search" (search term) and "field" (database field
heading) which then renders a partial with the search results on it.
########################################################
if
2007 Aug 04
3
Normality tests
Hello All,
I am new to R, and I am writing to seek your advice on how best to use it to run
R's various normality tests in an automated way.
In a nutshell, my situation is as follows. I work in an investment bank, and my
team and I are concerned that the assumption we make in our models that the
returns of assets are normally distributed may not be justified for certain
asset classes. We are
2012 Dec 18
2
cache-busting non-digest assets in sprockets in development a good idea? should headers in sprockets be configurable?
Just monkey patched Sprockets in our Rails 3.2.9 app to override the
Cache-Control header for html assets that we need to tweak more often in
development, but that we don''t want to use digests/fingerprinting with:
# Sprockets 2.x patch
if Rails.env.development?
module Sprockets
module Server
private
alias_method :sprockets_headers, :headers
def headers(env,
2006 Feb 03
7
how to add multiple new records from one form
I''m trying to provide our customers with a page where they can add up to
20 items to their cart in one form. The form simply has 20 rows with
each row containing a text input for product code and a text input for
quantity.
I''ve tried having the controller create an array that has an object for
each row by looping through something like:
@new_items[1] = Cart.new
and the