similar to: select method

Displaying 20 results from an estimated 2000 matches similar to: "select method"

2006 Apr 06
2
using select() to relate tables
I''m sorry to be asking trivial questions, but I''m new to RoR and am hooked :), so I''m very impatient to get things up and running. given two related tables, "pcs" and "venues" (venues have many PC''s and each PC belongs to one venue only) I can use a select() to present venue names in the "new PC" form along with other PC details to
2006 Feb 21
4
Select error
This code: <p> <label for="resource_type">Type</label><br/> <%= select(:resource, :type, %w{ Web Data }, { :include_blank => true }) %> </p> Produces this error: TypeError in Resources#new Showing app/views/resources/_form.rhtml where line #6 raised: wrong argument type String (expected Module) Extracted source (around line
2006 Apr 22
6
nOOb question: How to use find_all with form input data
Hello, I''m having a problem utilizing the find_all method with a value from a form. I keep getting the following error: Mysql::Error: #42S22Unknown column ''category_id11'' in ''where clause'': SELECT * FROM items WHERE (category_id11) The controller seems to be getting the correct data, but my key and value seem to be mashed together(it''s
2006 Jan 12
17
Application.rb params
I need to check if a parameter is set so that I can build some information for my application, but No matter how I format my if statement in the file " Application.rb" it return the following error. You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occurred while evaluating nil.[] Here is the line if params[:day] So we
2006 Apr 05
25
How to avoid bunch of <% %> ??
Hello, I would like to know is there is a way to avoid poluting the views with tons of <% %> ? Like this <%= start_form_tag() %> <%= text_field_tag(''category[title]'', category.title, {:size => 20, :maxlength => 128}) %> <% if not category.parent_id.nil? %> <%= select("category", "parent_id", Category.find(:all,
2006 Jul 05
3
splitting a story with double-spaced para''s
Quick question - if i want to separate a long string of text, separated by single carriage returns, into an array of paragraphs, I can use the following code: paragraphs = article.content.split("\n") The "\n" means a carriage return, as far as I can tell. If I wanted to take text, that had been written using the more common double carriage returns, into an array of
2006 Jan 10
5
Select Tag and Associations
Hi there, I''ve been working on this for awhile and have finally decided to ask for a little guidance.I have a slight problem trying to save a selection. I have two models: A "Posting" has_many "Categories", and a "Category" belongs_to one "Posting". With that said, in the posting model I have "has_many :categories" and within the
2006 Aug 18
4
Button on view
Hi, I have a page containing 3 views (2 are partials). One of the partials needs to have a button that will clear a table called "messages" in the database. I can put a button like this "<%= button_to "Clear Messages", :action => ''clear_messages'' %>" and have the controller do "Message.delete_all". But the problem is that the
2006 Mar 22
4
Newbie - populating select list from db
Can''t seem to find an example of this anywhere - how do I populate a select list in a form from a database? I have a form to create a new task. The task is for a client, so there should be a select list populated from my clients table. I thought this would work: <%= select ''task'', ''client_id'', Client.find_all, "id", "name"
2006 Apr 25
3
select boxe
yop, http://rubyonrails.org/api/classes/ActionView/Helpers/FormHelper.html ici j''ai vu qu''on pouvait g?n?rer des ?l?ment d''un formulaire gr?ce des m?thodes. Apres quelque petite recherches j''ai trouv? comment g?n?rer un select <%= select(''category'', ''category.id'', Category.find_all.collect {|category| category.nom})
2006 Jun 25
3
select box''s
Hi, I have this code for a select box, <%= select("plugin", "plugcats", Plugcats.find_all.collect {|p| [ p.title, p.id ] }, { :include_blank => true }) %> at the minute it extracts teh requried data, but submits the data as params[''plugin''][''plugcats''] how can I get it to submit it as
2006 Jun 16
3
ActiveRecord, using sql functions for some attributes
Hi. I need to use functions INET_ATON, INET_NTOA for IP address retrieving. Is it possible to make this transparently (without custom SQL for saving, updating and retrieving)?
2006 Jul 05
1
time.next_week bug?
i ran into an error today when dealing with the method next_week and daylight savings time... >> Time.local( 2006,10,23 ).next_week => Tue Oct 24 00:00:00 EDT 2006 Any one know if this is a know issue or should a ticket be created for this issue? thanks for the help mark -- Mark Van Holstyn mvette13@gmail.com http://lotswholetime.com -------------- next part -------------- An HTML
2006 Mar 29
11
why belongs_to does not like validation?
This works : class Recipe < ActiveRecord::Base belongs_to :category end But (when I add validation) this does not work : class Recipe < ActiveRecord::Base belongs_to :category validates_length_of :category, :within => 6..20 validates_uniqueness_of :category, :message => "already exists" end thank you -- View this message in context:
2006 Apr 11
26
Firefox won''t let me send ''&'' with AJAX!
Hi everyone, I''ve encountered a HUGE problem, which may not be RoR-oriented, but there might be a workaround somehow. See, at this moment, I''m unable to send AJAX requests back and forth when the information contains an ampersand (''&''). In essence, request is never completed. The odd thing is that it only happens with Firefox (IE and Opera works fine).
2006 Jan 01
7
Can''t get select helper to populate dropdown w/default value
Guys, I searched this forum and found plenty of people having this problem, but I didn''t see any definitive solution. Usings Rails 1.0. When I edit an existing record, I can''t get the basic "select" helper to display the current value contained in the field of the record. All of my other (text) fields populate correctly with current field values. There appears
2006 Jul 03
13
Eager loading ActiveRecord objects
I have a complex graph of ActiveRecord entities that I want to load with one big honkin'' join query to avoid ripple loading. It''s for a report. However :include doesn''t get me all the way there because I want to load parents of parents (or children of children). I don''t mind doing the SQL by hand but I''m not quite sure what to do to get the result
2006 Feb 20
5
find(:all) vs find_all
I started with Ruby on Rails in the 0.13.x period, so I''m sure I missed out on a lot of history. There''s probably some good explanation for something I''ve been wondering about, but I haven''t seen it written down anywhere. Maybe someone can clue me in. I''ve always felt that one of the uglier APIs was the ActiveRecord::find() method. I call
2006 Apr 16
11
Best way to sort categories w/ pager
Ahoy, I made this pager, " def list @item_pages = Paginator.new self, Item.count, 10, @params[''page''] @items = Item.find :all, :conditions => "category_id = #{params[:condition]}", :limit => @item_pages.items_per_page, :offset => @item_pages.current.offset @categories = Category.find_all
2006 Feb 19
8
select, first option empty value?
using the below: <%= select(''project'', ''project_type_id'', @project_types.collect {|x| [x.name,x.id]}, {:include_blank => true}) %> but i''d like that first option to have something like "select project type" with an empty value?