Displaying 20 results from an estimated 5000 matches similar to: "Select box problems"
2006 Jul 08
2
Creating/Saving dependent objects
Folks,
Am new to RoR and am building an example to get myself familiar. I am
running into a simple issue while creating a user registration page.
I have a User and Address models defined as below (partial/relevant code
included below). User has_one address and Address belongs_to user. I have a
foreign key defined in address table that refers to user(id)
In a form I take in username, password,
2006 Jul 17
1
acts_as_tree and :include
hello there,
i have a model that uses acts_as_tree:
>class GbEntry < ActiveRecord::Base
> acts_as_tree :order => ''created_at DESC''
>end
and i want it to paginate, including all children to avoid unnecessary
db queries:
> @gb_entry_pages, @gb_entries =
> paginate :gb_entries, :per_page => 15, :order => ''created_at DESC'',
2006 Apr 07
2
errors.add_to_base
What are the limitations on using:
errors.add_to_base
to display errors in views?
I have tried for days to add errors from my object.rb and they never get
displayed.
class Keyword < ActiveRecord::Base
validates_presence_of(:name, :message => "Name is required.")
validates_uniqueness_of(:name, :message => "This name is already in
use. Please try
2006 May 14
0
Beware of HashWithIndifferentAccess#symbolize_keys!
Hi,
I just posted a patch tot he rails trac for a bug we found where
running symbolize_keys! on a HashWithIndifferentAccess will delete all
items from the hash. Please make sure you either never call
symbolize_keys! (or to_options! which just alias it) on a
HashWithIndifferentAccess, or apply the path attached from the ticket
at: http://dev.rubyonrails.org/ticket/5076
I also posted a much longer
2006 Oct 16
3
Saving many_to_many
Ahoy, i''m trying to save a many to many between "talent" and "vital
stat"
talent_controller.rb
def edit
@talent = Talent.find(params[:id], :include => [:talent_type,
:vital_stats])
@talent_types = TalentType.find_all
@vital_stats = VitalStat.find_all
if request.post?
@talent.attributes = params[:talent]
@talent.attributes =
2008 Jan 21
1
specin'' update_attributes! + Hash
Hi,
I am facing a problem while trying to test a method that updates an
attribute. The attribute format should be converted to YAML format
before storing in the table which is excatly what is going on. But when
testing it using expectations in rspec it returns an error.
*** below is the error message :
Spec::Mocks::MockExpectationError in ''InteractController (submit) -
saving a form to
2012 Jun 01
3
Serialized attribute saved as HashWithIndifferentAccess in database
My Booking model has: serialize :custom_data, Hash
From the console it works as expected saving values to the custom_data
attribute.
But when having a form with parameters like
this: booking[custom_data][hello] and creating a new object in the
controller like this: Booking.new( params[:booking] ), values are saved in
the database with added metadata like this: ---
2006 Jun 17
2
URL based on acts_as_tree using routes
Hi There!
I''d like some feedback before I try to implement some funky rails
routes based on an acts_as_tree model.
I have a Page model that acts_as_tree. I''d like the URLs to look
something like this:
http://localhost/about-us/staff/jeff
or, another example...
http://localhost/what-we-do/products/our-great-cms/features/faqs/
So, as many sub-nodes the user creates,
2006 Feb 02
12
basic ''find'' question
I am struggling to understand the methodology here...
I have a find.rhtml
<%= start_form_tag :action => ''list2'', :first_name = client %>
<%# render :partial => ''form'' %>
<p><label for="client_first_name">First name</label><br/>
<%= text_field ''client'', ''first_name''
2007 Feb 14
3
eager loading parents and children (acts_as_tree)
I am struggling with how to do eager loading of an acts_as_tree model.
If the model Stuff acts_as_tree I know I can do this to get children as
well:
Stuff.find(:all, :include => :children)
But what if the model I am including is the one that acts_as_tree?
For example, say Picture belongs_to Category. Category acts_as_tree and
I want to get all pictures that are members of a category that
2005 Dec 03
1
typecasting HashWithIndifferentAccess
I want to typecast an object of HashWithIndifferentAccess (params) to Hash.
Whats the way of doing this (except each?)
Thanks in advance.
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails
2006 Jan 11
1
HELP!! - ActiveRecord derivates in AWS :expects method
Hi,
I have a strange problem while using WebService API which expects an
ActiveRecord derivate.
This is the code of the API ...
------
class HarvesterApi < ActionWebService::API::Base
api_method :send_measurand,
:expects => [{:measurand => Measurand}, {:eaiSystemName =>
:string}]
end
------
... and this of my Model
------
class Measurand < ActiveRecord::Base
2006 Nov 01
0
Re: YAML.load(some_string) doesn't return hash?
Oleg Kh wrote:
> A small problem here. As per documentation on
> http://corelib.rubyonrails.org/classes/YAML.html YAML.load(string)
> should just return a hash. However on my windows machine it returns
> something like this:
>
> #<YAML::Syck::DomainType:0x36d5038
> @domain="yaml.org,2002",
> @type_id="map:HashWithIndifferentAccess",
>
2006 Jul 20
3
acts_as_tree
Hello,
I''m trying to create categories that have their own subcategories, and each
subcategory may have its own subcategories, .. and so on.
After some reading, I found out that the best way for creating such a thing
is to use acts_as_tree, but I didn''t find any tutorial or article that
explain this in a clear way. After a lot of work I was finally able to
create categories and
2009 Jun 20
1
Template problem
So this works from the command line:
script/plugin install git://github.com/rails/acts_as_tree.git
BUT this doesn''t work inside a template:
plugin "acts_as_tree", :git=>"git://github.com/rails/
acts_as_tree.git", :submodule=>true
The error I get is:
fatal: Not a git repository (or any of the parent directories): .git
I have nothing else in my
2006 Apr 12
2
Why doesn''t acts_as_tree support :scope?
I want to implement a unique category tree per user in my system, and I
was hoping to use "acts_as_tree" on my category model. It seems as if
acts_as_tree makes the assumption that the entire table the model is off
of is one large tree. I actually want each user to have their own
category trees all stored in the category table so I need it to scope
off of the user_id.
2006 Jun 20
2
Converting from acts_as_tree to acts_as_nested_set
I''m currently using acts_as_tree to display threaded Comments on my
forums-like site. It''s waaay too slow to display a page with 1,000
comments, as it''s issuing a TON of selects.
I''m pretty sure I want to convert to the nested set model, using
acts_as_nested_set or acts_as_threaded. This should give me the
performance I''m looking for.
The problem,
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
2008 Apr 12
1
acts_as_tree undefined method?
i have acts_as_tree installed as plugin under rails 2.0.2 and also its
defined in class TreeItems, but when i put this in my view
<ul class="tree_level1" id="cars">Furniture
<% TreeItem.root.category.children do |cat_children| %>
<li><a class="list_item" href="#"><%=h cat_children.name %></a></
li>
<%
2007 Jan 25
1
acts_as_tree with acts_as_list
Hello all,
I''m having trouble using acts_as_list with acts_as_tree
to order the "children". I''ve found a few old posts on the web
that seem to indicate that this once worked.
class Whatever < ActiveRecord::Base
acts_as_tree :order => :position
acts_as_list :scope => :parent_id
Although the ''position'' field is being populated,
it appears