Displaying 20 results from an estimated 7000 matches similar to: "How do you display nested elements in their hierarchy?"
2006 Jan 31
13
Acts_as_authenticated
Hello
I have been trying a number of security/login generators recently. My
favourite so far is the Acts_as_authenticated. I like the fact that it
is only billed as a starting point and doesn''t try to do everything.
I would like to add security roles to it, so that some of my controller
actions can only be used by an admin role. Has anybody implemented this
using
2009 Feb 20
1
better nested set and parent_id
Hello everybody
I have a model with better_nested_set. In my "new" form, i pass the
desired parent_id as a hidden field, and in the create action at the
controller i save the new register and use move_to_child_of Model
(params[item][parent_id])
Everything works, but at my log file it warns that i can''t mass asign
the property "parent_id".
What can i do to avoid the
2008 Jul 11
1
Using custom routes to handle new nested resources
I have a couple of resources, one nested in the other, such that my
resource spec in routes.rb is:
map.resources :parents, :has_many => :children
This will generate a route for a new child that assumes that the parent
has already been saved, something like:
/parents/:parent_id/children/new
But what if I want a route that handles the case where the parent
resource is also new, and thus
2005 Feb 05
4
Creating collections
I''m trying to create a form where a collection is created, using the
example from the Rails 0.9.5 weblog posting:
http://weblog.rubyonrails.com/archives/2005/01/26/rails-095-a-world-of-
fixes-and-tweaks/
I''m having a bit of trouble. The controller currently looks like this:
class StudentController < ApplicationController
def new
render_text @params.inspect
2006 Apr 30
4
acts_as_ordered_tree
I need an ordered (sortable tree) and I just was thinking if somehting
like this is possible:
class Item< ActiveRecord::Base
acts_as_tree :order => "position"
acts_as_list :scope => ''parent_id = #{self.id}''
end
For my understanding mixing of two acts_as should be p?ssible, at least
in this case, right?
Unfortunatly the :scope is not working, I am not
2009 Mar 08
2
RESTful nested resources and polymorphism?
With ref to my previous post: http://www.ruby-forum.com/topic/180356
I am now able to access items from topics controller. However, now I
need to add sub-item e.g.: An item itself could have many sub-items. So
my items model is like:
class Item < ActiveRecord::Base
validates_uniqueness_of :title, :scope => [:topic_id]
validates_presence_of :topic_id, :title, :owner, :position
2009 May 22
1
[PATCH server] fixed smart pool 'save' regression.
The recent refactoring didn't work properly for new smart pools, so I've cleaned jup the parameter handling for the various pool 'create' actions.
Signed-off-by: Scott Seago <sseago at redhat.com>
---
src/app/controllers/hardware_controller.rb | 5 +----
src/app/controllers/pool_controller.rb | 6 ++++--
src/app/controllers/resources_controller.rb | 6
2005 Nov 25
2
acts_as_list with 2 fields in the scope
Hi Railers,
I''ve got a Categories table.
I want it to act as a list within the scope of the parent_id AND the
site_id.
Categories table :
id
label
site_id
parent_id
So, in my Category class, I have :
acts_as_list :scope => ''site_id = #{site_id} AND parent_id = #
{parent_id}''
The problem is that when I try to move_up a Category with a parent_id
that is null,
2014 Nov 24
3
[PATCH] v2v: -i ova: Remove incorrect warning for disks that have no parent controller (RHBZ#1167302).
Don't assume every disk <Item> has a <Parent> field. For floppy disks
this is not the case.
Thanks: Junqin Zhou
---
v2v/input_ova.ml | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml
index 95af2e5..9a9c10a 100644
--- a/v2v/input_ova.ml
+++ b/v2v/input_ova.ml
@@ -187,14 +187,17 @@ object
for i = 0 to
2006 Jun 19
3
Using set_primary_key breaks acts_as_tree with non-integer column
I just switched from using the standard "id" column into using my own
primary key and generating my own unique id for each record. But, this
breaks acts_as_tree.
Because my new primary key is not an integer, it breaks the SQL query
as follows:
StatementInvalid in PagesController#create
--------------------------------------------------------------------------------------
2006 May 07
3
Stupid newbie question
Here''s a request string which has a value I want to pull out from the
category array - parent_id.
Parameters: {"category"=>{"name"=>"Condiments", "parent_id"=>"1"},
"commit"=>"Create"}
How do I reference that subelement in the receiving script? I''ve tried
params[:parent_id]
2006 Nov 06
21
acts_as_ferret and associations
I have the following models:
class Book < ActiveRecord::Base
acts_as_ferret
belongs_to :author
end
class Author < ActiveRecord::Base
has_many :books
end
and in the controller:
def search
if params[:query]
@query = params[:query]
@total, @books = Book.full_text_search(@query, :page =>
(params[:page]||1))
@pages =
2005 Sep 23
6
problem with acts_as_tree
Hi,
I''m using the latest gem version of rails under MacOS Tiger.
I was trying to use acts_as_tree as described in the rails book. So
I have something like:
class Category < ActiveRecord::Base
acts_as_tree :order => "title"
end
create table categories (
id int not null
auto_increment,
title
2005 Jul 25
2
acts_as_tree and traversing parent/child relationships
I am working on an Rails application that uses a pretty complex
category structure through out the site. I have defined a table to
house all the info and a FK to reference parents within the table
CREATE TABLE categories (
id int(11) NOT NULL auto_increment,
name varchar(50) NOT NULL,
parent_id int(11) default NULL,
constraint fk_category_id foreign key (category_id) references
2009 Feb 19
3
Associated child records not created on creation of a parent.
I am trying to create a record with association. Within the create
method, I would also like to pre-populate dependent (has_many) records
from a template in the database.
The child records are <u>mysteriously rolled back </u> if I insert
them in a loop. If I try to insert a single child record, it works.I
have read the books and tried to google my way out of this but am at a
dead
2007 Jan 17
2
rake test and validates_inclusion_of
Hello,
I am just starting off with Rails, so I apologize in advance if there
is a terribly obvious answer to my problem. I''ve done some searching
and found similar problems to my own, but nothing which yielded a
solution.
I have a handful of models that I am unit testing. The tests for each
unit run successfully, but when I do a rake test, many of the tests
fail.
The assertions that
2006 Jun 16
1
sortable acts_as_tree with heirarchy
I''ve been stumbling on the tut at oriontransfer
(http://wiki.oriontransfer.co.nz/main/show/SortableTree)
I''ve got it working in a one dimensional list and I''ve got the drag and
drop working on children, but as can''t get it to save the tree.
Here''s my view:
<h2>Menu Prototype 2</h2>
<%= flash[:notice] %>
<ul
2006 Feb 08
1
Many-To-Many w/acts_as_tree?
Guys,
I''m having a problem getting acts_as_tree working. It seems from the
Agile book (p. 255) that acts_as_tree only supports one-to-one record
relations, whereas I need many-to-many support. In other words, looking
at the picture at the top of page 256 where where only 1 id is linked to
1 parent_id, I need multiple id''s linked to multiple parent_id''s - for
2006 Jan 09
1
Saving an upload
I am creating a database for movies (films) and television shows (shows)
that will have has_and_belongs_to_many relationships with the pictures
table.
CREATE TABLE screenshots (
id serial NOT NULL,
filename character varying NOT NULL,
content_type character varying NOT NULL,
primary key (id)
);
CREATE TABLE films (
id serial NOT NULL,
name character varying NOT NULL,
2006 Jan 12
4
How do you create a tree strucutre with ActiveRecord
I want to build an application that has the concept of administrative
domains. What I mean by this is that administrators have access to
different data, based on what domains they are a member of. The domain
strucutre is hierarchical. Here is an example:
- MLB
- AL
- East
- Yankees
- Red Sox
...
+ Central
+ West
- NL
+ East
+ Central
+ West
Now