similar to: f.collection_select: what are the parameters?

Displaying 20 results from an estimated 2000 matches similar to: "f.collection_select: what are the parameters?"

2006 Jan 22
11
ActiveRecord find
Suppose I have three tables - authors, posts and topics. Every post have a topic and every topic has an author, so I have posts.topic_id and topic.author_id. When the author is guest (not registered), author_id is nil. I need to find all the posts (in one query) where every post have all the information of the topic and the auther, so if p is one of those posts I could get the name of the
2010 Feb 10
7
undefined method join
Hey all, I get an undefined method `join'' for #<String NoMethodError. student.rb has_one :student_fail attr_accessor :student_fail_attribute #controller def student_fail @student = @student.find params[:id] def update_student_fail @student.build_student_fail params[:student][:student_fail_attribute] if @student.save #view form_for @student do |f|
2006 Mar 31
2
A.R. Associations problem
Hello, I''m learning A.R Associations by creating a simple forum that consists of 3 tables: ahuthors, topics and posts. This is the schema: class AddAuthorAndTopicAndPostTables < ActiveRecord::Migration def self.up create_table :authors do |t| t.column :username, :string t.column :email, :string t.column :created_on, :datetime end create_table
2005 Jan 21
2
collection_select
I''m trying to use collection_select, but it''s not working as I expect. The list populates correctly but the current value is not selected. @question contains a topic (via topic_id), and @topics is the list of all topics. Here''s my attempt to create a drop-down list of the topics. form("question") do | form | form << content_tag("b",
2011 Dec 04
10
bash: rails: command not found
Hey, I''ve checked my gems env, appears to be fine. Is there anything else I can check to see why it is not recognising the Rails command? I have read a number of post and they all seem to point back to PATH. BTW: Using Ubuntu OS. Cheers, James -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group,
2011 Jun 11
8
Help with railroad
Can anyone help me install railroad gem? What I need is a simple class diagram of my rails website. Not necessarily with railroad (if you know any other software, for mac, that works). The website is http://railroad.rubyforge.org/ I couldn''t find any explanation on how to install it. Thank you, Rodrigo -- You received this message because you are subscribed to the Google Groups
2006 Apr 06
1
drop down menu - getting @params[:id] value.
I am looking to get my option drop down list to populate from a model. In my controller i''m using: @roles = Role.find(:all, :order => "name") in my view I have: <%= collection_select(:id, :name, @roles, :id, :name) %> role <%= submit_tag("Go") %> I cannot get just the id of the selected option. If i inspect the params I get:
2006 Jul 16
6
using collection_select
hello, supposing i have a User class that contains a Wibble class User < ActiveRecord::Base has_one :wibble end in my view i have <%= collection_select :user, :wibble, Wibble.find(:all), :id, :name %> when i post, i get an error like "Wibble expected, got String" how/where am I supposed to convert this posted wibble_id into a Wibble, or am I using collection_select
2006 Apr 24
4
creating a select box
Hi trying to create a select box in _form.rhtml. I have a table called organisations that contains fileds, 2 being ''id'' and ''name'' these are the fields I need to bring over to the clients _form.rhtml. whats the best way of going about that?? 2 ways i have seen suggested that I cant get to work -@organisations = Organisation.find_all placed this in def new
2013 Nov 09
6
Learning Ruby - Don't give up
An article for those starting learning Ruby Learning Ruby - Don''t give up<http://arubystory.blogspot.com/2013/11/dont-give-up-on-ruby.html> -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to
2006 Jan 25
2
select list generated from table
Have 2 tables - clients & case_managers class Client < ActiveRecord::Base has_one :case_manager end app/views/clients/_form.html contains line... <p><% collection_select("client", "case_manager_id", \ case_manager.find_all, "name", "id") %></p> and this line generates error... undefined local variable or method
2009 May 24
6
belongs_to not saving foreign key
Under Rails 2.3.2 using a completely brand new project, I have 2 models: class Author < ActiveRecord::Base # name:string end class Book < ActiveRecord::Base # title:string belongs_to :author # author_id end And a simple test where i create a Book with an Author using the belongs_to and then update the foreign key directly: require ''test_helper'' class BookTest
2006 Mar 28
5
combining two models in one controller/view "set"
I''m going to take another stab at this question (my first one received no replies): I have two models: Author has_many: books Book has_one: author I have two tables: authors id ... books id author_id ... I let the scaffolding fly and it created the CRUD goodness for each model, as expected. However, I want to have only one view/controller "set" for both models; when I
2006 May 23
5
AR Caching and Reflection
When I do this: term = Term.find(1, :include => :definition) term.definition.term Two SQL queries are fired, why? -- Posted via http://www.ruby-forum.com/.
2005 Apr 20
4
Error in tutorial or sintax changed?
Hi, In this tutorial http://wiki.rubyonrails.com/rails/show/HowtoUseJoinsWithFindAll it sad: sql =<<SQL SELECT articles.*, authors.name AS author_name FROM articles LEFT JOIN authors ON author_id = authors.id SQL and this return *app/controllers/media_controller.rb:366: can''t find string "SQL" anywhere before EOF* what is wrong? the tutorial or ruby changed? please,
2006 Feb 28
2
Need help with a Power Find()
I was hoping someone would be able to help me with creating a method. I have two tables. What I am trying to do is create a list of all the id''s from table2 that aren''t currently referenced by Table1''s address_id column. That way, when I create a new customer I can have a drop down list in the view of all the addresses that are not currently being used. ##### Database
2006 Jun 13
6
Dead horse: validates_associated
Regarding validates_associated... Let''s say I have: article belongs_to author But for whatever reason, I want an article to also be written anonymously and therefore not require an author. Then I have: Article: belongs_to :author validates_associated :author But I DON''T have validates_presence_of. What I want to do is validate that an author is valid --if it is
2008 Jan 10
2
Getting results matching with an array?
I have an array authors=[1,3,7] and I want to get all the posts that match with any or all of these results. something like... posts = Post.find(:all, [:conditions => ''''author_id = ?'', authors]) of course this wont work but I need something like it that works.. thanks -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~
2006 May 26
4
What association do I want here, has_ or belongs_to?
I thought I had a handle on this one but it''s causing me grief and I''m hoping somebody can set me straight. I have an object AlertTemplate which will contain a fill in the blank style hunk of web content. I then have an object, Alert, which will have a relationship to one of those AlertTemplate objects, plus some data. So, in human speak, I''d think that an Alert
2010 Feb 10
2
undefined method 'state'
I can''t imagine what I''m trying to do is complicated at all in Rails. Yet, I am now getting this error: undefined method `state'' for :StudentFailState:Symbol. student.rb has_one :student_fail attr_accessor :student_fail_attribute #controller def student_fail @student = @student.find params[:id] def update_student_fail @student.build_student_fail