Displaying 20 results from an estimated 7000 matches similar to: "Beginner questions on attributes and arrays"
2006 May 29
9
design recommendations for authenticating users with lots of different attributes..?
I''ve been struggling a bit trying to figure out the best way to
design/implement a system with authentication/authorization, and was
hoping some of you may be able to offer some advice..
At the moment, I have a system with 4 different types of users -
clients, administrators, sales_reps, and public_users. I''m using
"Authorizing Users with Roles" from the Rails Recipes
2012 Dec 03
1
Resampling Help Needed
I am using package ks() to build 3D representations of bird territories and
calculate territory volume from spatial data (simply x, y, and z
coordinates). What I want to do is determine at what sample size (#
locations collected) does the territory volume stop increasing. This should
give me an idea of the number of points needed for future seasons.
So I have a couple of birds each with 200
2006 Mar 26
2
Problem with names() in a plot after ordering a data.frame. Syntax or stupidity?
I am a complete newbie in R .
Using R 2.2.0 Windows XP
This started as a simple exercise to see if I could
produce a simple
Cleveland style dotchart with a line from the '2' axis
to the dot rather
than a continuous line as do "dotchart" and
"dotchart2". At least I could not
find that option.
I got a crude program to work but it includes
unnecessary steps.
2006 Feb 08
5
beginner - problem with understanding relationships
Hi folks,
I''m new to this... so hopefully someone can help me.
I have a few objects... Property and Address and Landlord... where a
Property has an address and a landlord has an address also.
I''ve modelled this in the db with the properties table having an
address_id and the landlord table having an address id.
My rb looks like:
class Property < ActiveRecord::Base
2006 Apr 08
7
text_field and arrays
Hi,
I''m trying to do a bulk update on an array with the helper text_field.
I''m trying to create an inputfield for every object in the array, but
I''m not getting it right...
example:
class ClassA
@arrayB[]
end
HTML (code with error):
<% 0.upto(9) do |index| %>
<%= text_field ''ClassA'', ''arrayB[index]'' %>
non
2006 Feb 10
1
glmmPQL and random effects
Hello R users,
I am trying to run a model with a binary response variable (nesting
success: 0 failure, 1 success) and 8 fixed terms. Nesting success was
examined in 72 cases in 34 territories (TER) during a 6 study years.
Territories are nested within 14 patches (PATCH). I want to run a model
taking into account these nested factors and repeated observation. To do
this, I assume that the best
2006 Jul 13
4
Does text_field go directly to attributes hash in AR object?
All,
I''m having a hell of a time figuring out what is going on here.
I''m trying to override one of my getters so that I can format it a
certain way in my form. But I can''t seem to get text_field to call the
appropriate method on my object.
So here''s my getter:
public
def FAX
fax = read_attribute(:FAX)
puts fax
2006 Apr 28
1
beginner - default form values
I want to build a simple calculator with 1 form and a results page.
The form will be redisplayed with an error message upon an invalid value
entered.
I won''t be using any database/active record for this.
The problem i have is when i return to the form page i want to redisplay
the values already entered in the form fields.
Should i use text_field (which seems to be tied to a model) or
2006 Feb 24
1
Help a n00b?
So I''m trying to do that hot new thing with AJAXy forms:
http://idiet.toasterwaffles.com/foods/list
Here''s the relevant code in list.rhtml (for the form portion)
<tbody>
<%= render_collection_of_partials "list_stripes", @foods %>
</tbody>
<tfoot>
<tr id="addFood"><%= form_remote_tag( :html =>
2006 Aug 03
5
Rails - forms
Currently I have a registration form that is built like this:
<label for="First name">First name</label>
<%= text_field "user", "first_name" %><br>
<label for="Last name">Last name</label>
<%= text_field "user", "last_name" %><br>
<label for="Email">Email</label>
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 Jul 21
1
How to dynamically add more rows and submit data
Let''s assume that I am trying to build an application where the user can
enter invoice.
In the app the user can add lines items. Each line item has decription,
date, rate and hours.
When the invoice screen comes up the first time I have one blank row for the
line items.
<tr>
<th>Description</th>
<th>Date</th>
2006 Apr 06
3
Formating Float ActiveRecord attributes in text inputs
I have AMOUNT field that ActiveRecord maps to Float.
Then I use text_field helper to generate text inputs on forms.
Helper takes model object and attribute name and does not provide any
formatting abilities, thus 2.40 is shown as 2.4 which is fine with
floats but does not look good with currency.
I have worked around this issue by adding amount_f attribute to the
model that returns formatted
2006 Aug 16
4
Overwrite form helper methods and call old ones in new ones?
Hi all
All my forms should look the same, so I think always putting the right
div etc. tags around them is a violation of the DRY principle.
Until now my forms look like that:
<div class="text_field">
<label for="news_item_subject">Subject:</label> <%= text_field
"news_item", "subject" %>
</div>
Now I want the default
2006 Feb 07
3
Newbie help ..
Hi ..
I am new to Rails and it is not clear to me why I am getting the
following error. Any help appreciated.
-m.
$cat app/views/admin/new.rhtml
<% @page_title = "New member..." -%>
<%= start_form_tag( :action => ''create'' ) %>
<table>
<tr>
<td> First Name: </td>
<td> <%= text_field(
2006 Apr 25
2
Noob Question: REgarding Forms ( Take 2 )
I''m hoping there''s an easy way to do this. I''m trying to read options
from a database, and insert them into form tags. So for example,
In the Database Table: options
size: 300
type: text_field
maxsize: 300
and I want to create a text_field form tag, with all the appropriate
options, is there an easy way to do this, other than having the code
output the HTML
2007 Sep 18
2
Setting default value in text_field/password_field
I am trying to set a default value in a text_field form. I know how
to do this in html, but is there a way to do
this with form_for
Here is my code
<% form_for :user do |f| -%>
<p><label for="firstname"%>First Name</label><br/>
<%= f.text_field :firstname%></p>
...
<p><label for ="email"%>Email</label><br/>
2006 Apr 08
2
ActionView::Helpers::FormHelper instance methods should take an object reference rather than an object_name.
Hi
ActionView::Helpers::FormHelper methods (e.g. #text_field,
#check_box...) take object_name as an argument. From this argument
they infer a name that is supposed to contains the reference to the
relevant object.
I can''t see why the FormHelper methods were designed that way.
Compared to simply passing them a reference, the current way seems too
complicated and an invitation to problems
2008 Jul 17
2
Final Opinion :: Need final opinions on the best way to handle arrays in forms
Hi There, rails noob just trying to suss a few things out.
So I have 2 tables. 1 called Posts and the other called comments. On
one page I need to be able to edit both the information about the post
and the attributes of each comment for that post. So here is what the
array might look like:
(Inside the params hash)
"post" => [
{"id"=>28, "title" =>
2006 Apr 06
3
Inserting parent_id
I have two tables:
- projects
- lines
lines has a foreign key constraint to projects.id
When I''m creating a new line object, the database fails on insert with
the following error:
"PGError: ERROR: null value in column "project_id" violates not-null
constraint"
My code looks like this:
def create_lines
@project = params[:id]
@line =