Displaying 20 results from an estimated 1000 matches similar to: "No Magic for HABTM forms?"
2006 Feb 20
0
How to reference a field of an associated object in a text_field
Hi,
I hope someone can help, I am stumped.
I have a Registration ActiveRecord object. It records registrations
for people for classes.
class Registration
has_and_belongs_to_many :people
has_and_belongs_to_many :scheduled_courses
end
I have a form that allows someone to register. A registration form
will register two people. They fill in their names, addresses, and
the classes they
2010 Jan 20
0
need help with nested forms and habtm
Hi,
I''m currently stuck with a problem I just can''t find a clever solution
for. I checked every tutorial, issuetracker, API reference I could
find but found nothing to "enlighten" me --> I desperately need your
help :-).
My Question is: is it possible to use nested forms for habtm
associations?
--> Here some more info about what I wanted to do and what failed
2006 Feb 27
2
Multiple forms on a page
Hello all.
I have the following Code in a view:
<% @dishes.each do |dish| -%>
<tr>
<td><%= link_to dish.name, :controller => "restaurant", :action =>
"show_dish", :id =>"#{dish.id}" -%>
<% if dish.vegetarian? -%>
<%= image_tag("/images/vegetarian.gif", :class => "bevel", :size =>
"8x8")
2006 Jul 18
2
A quick question on forms
I want to change parts of this form in order to use default values (with a
disabled input). The problem is if I change it from text_field to
text_field_tag that part of the form stops functioning. It seems like a
silly question, but its been driving me crazy. Any help would help.
Steve.
<%= error_messages_for ''post'' %>
<!--[form:post]-->
<p><label
2005 Dec 23
0
Problem with large join table and ActiveRecord
Hello,
I''m having a hard time explaining this, so I hope i can say this
correctly. I have these tables:
people
id
fname
lname
departments
id
name
buildings
id
name
room
wtkeys
id
key_number
key_way
Issued_keys
id
people_id
department_id
building_id
wtkey_id
date_issued
My
2011 Nov 05
13
Adding a site admin user while creating a site
Hi Gurus,
I wanted to add siteadmin user(basically a user with a certain role) while
creating the site itself. I hope that i have done all the necessary stuff
by going through raynb''s railscasts (
http://railscasts.com/episodes/196-nested-model-form-part-1) But could not
see user fields being displayed in the site creation form.. Below are the
details.
I Have two model users and
2006 Apr 05
3
CRUD pattern for has_many relationships (forms containing collections)?
Hello folks!
Beare with me for a second, while I explain my problem.
Assuming we have the trivial model of
class Author
has_many :books
end
class Book
end
How do people go about creating the authors/edit and authors/new
views if you want to be able to add and remove arbitrary amount of
Books at Author creation and edit time? What I mean by this is that I
go to
2006 May 31
6
habtm on an array (or object.habtm.habtm)
Hi,
I have three Models: User, Group and File.
User habtm groups
and
Group habtm Files
How can I find all files that a particular user has access to?
eg user.groups.files ?
As user.groups returns an array, the above doesn''t work.
Id like to find the files for all groups in that array, without adding
any code to the User model.
Thanks in advance
PS I just posted this in the
2006 Jul 30
1
Insert multiple new child records with the parent
Hello,
I am implementing a classic invoice application. On the create new
invoice page
I want to allow users to add new line items using AJAX:
-----------------------------------------------------------------------------
Invoice Date [ ]
Client [ ]
Line Items
1. [ ] $[ ]
<add new line item>
<save> <cancel>
2006 Mar 12
0
NameError when trying to combine Recipe 14 (rich HABTM) & Rec. 10 (self-ref HABTM):
Hi all,
I''m trying to model self-referential relations between people, where the
relation has attached data.
John ''works for'' Bob
Problem: '':through'' doesn''t work, and generates a NameError.
=> the models :
Person (attr: name)
Relation (attr: source_id, target_id)
(more details below)
ex: John ''works
2006 Aug 08
4
Nic’s Magic Models, how about Magic Schema
I side with David when it comes to databases. They suck! Just my own
opinion.
So what about the people who don''t want to define validations and stuff
in the database, but still want to be DRY.
I really hate how the schema is separate from my models. I kind of like
how Django defines the table attributes in the model. I was think about
trying something like that in Rails.
You could
2003 Jun 02
2
partition magic messed up my magic number
Hi,
I've been foolish enough to let Partition-Magic move/resize/etc. my partitions without a prior backup.
My ext3 /dev/hda7 (was RH 9) is no longer recognised by fsck.
I tried fsck -b 8139, 32768 and 65536 - but am not quite sure
about if these are the right ones to try.
So far I created another partition with same number of blocks and did a backup with
dd if=/dev/hda7 of=/dev/hda8
2006 Sep 13
1
insert a date like 2006-00-00
Mysql makes possible to insert a date like 2006-00-00. And i want to do
that, if my client dont knows the month he puts it to zero.
But when i do something like this:
fp = ProfessionalFunction.new(:people_id => 5, :start => "2006-12-0")
fp.save
it puts a NULL value in the start field (type date).
suggestions??
--~--~---------~--~----~------------~-------~--~----~
You received
2006 Mar 13
3
HABTM: two habtm''s between the same two tables
Imagine I want to track people, and the clubs that they belong to.
table people with columns person_id, person_name
table clubs with columns club_id, club_name
And I have the association table:
table clubs_people with columns person_id, club_id
Now I know how to do this habtm between the two, in order to associate
people with clubs that they belong to.
However my application also needs a
2012 Apr 18
2
RoR - Search Forms with Checkboxes, display appropriate results
I have a form that allows me to search a hotel by city or name and by
rating through radio buttons. It all works.
However, my hotel model has_one :facility, this facility model is
composed by several boolean fields (for example, roomservice:boolean
restaurant:boolean and so on)
The question is, I want to add checkbox fields for each facility I have
and in the search form, when the user selects
2006 Jul 28
2
has_many :through with multiple paths
Hi all.
I am currently thinking about how to do the following:
I have the following models.
Team
Person
Team has various positions (manager, programmer etc.) I would like each
one of those positions to reference one or more Person records. A single
Person record could be on 6 different teams at the same time in
different roles. the same person could even be on the same team multiple
times
2006 Nov 04
0
Model.delete_all vs Model.destroy_all in a habtm
Hi there
I have an habtm association between 2 Models.
I regularly have to truncate the table on one side of the relationship
and repopulate the table with a fresh csv file.
I notice that f I do Model.delete_all, none of the records in my habtm
join table get deleted, whereas if I use destroy_all they do.
However, the overhead of using destroy_all is too great. For the
amount of records I have
2006 Aug 07
0
question/problem with habtm and "include?"
I have what I feel is a standard habtm association to manage
user/roles/permissions. However, I''m having a small problem wondering
why ".include?" isn''t working like I thought it should.
I''m attempting to use this to determine whether a user has access to a
particular permission:
if session[:user].role.permissions.include?(''Lead List'')
2006 Aug 11
0
Paginating HABTM?
Is there an easy way to paginate HABTM? Something like (which doesn''t
work):
@pages, @directories = paginate :directories,
:include=>:categories,
:per_page=>ITEMS_PER_PAGE
directories and categories have an HABTM association.
Joe
--
Posted via http://www.ruby-forum.com/.
2006 Aug 11
0
habtm in a standalone ruby script broken?
Hi,
i have a ruby script which uses the activerecord models of my rails
application. this is achieved with
$LOAD_PATH << ''...../availdb/app/models''
require ''rubygems''
require_gem ''activerecord''
require ''host_downtime''
require ''host_scheduled_downtime''
And in .../app/models/host_downtime.rb:
class