similar to: (Nested) collection in a view

Displaying 20 results from an estimated 2000 matches similar to: "(Nested) collection in a view"

2013 Feb 18
6
How to clear ActiveRecord query cache on associations with dynamic table
In part of my application I''m using dynamic tables. I''m aware of the single thread conditions. I''ve tackled some caveats yet - will post a blog about it soon - but there''s one I need help with. Consider 2 models that are associated: Order and OrderLine where Order has many order_lines. Now we set the table names for them:
2006 Mar 21
11
Stuck on ActiveRecord
Hi, I''m having great fun developing with Rails but I''ve come to a problem that I can''t quite figure out. I have an Order object that "has_many" order_lines. This works perfectly and I can see all the lines. The OrderLine object has an order_id field as well as product_id and amount. Now ideally I would want to do : order.orderline[0].product.name for
2007 Sep 05
8
Hi..Guys new plugin again
Hi.. Guys new plugin again Foreign Key Associations is a plugin that automatically creates associations based on foreign-keys. The associations are created at runtime-ie. as your ActiveRecord models are loaded-so they will always be up-to-date. For example, given a foreign-key from a customer_id column in an orders table to an id column in a customers table, the plugin creates:
2006 Jul 26
2
text_field and date_select in collection
hello, i would like to display a collection of records on one page (e.g. an author record with all his/her books). a record contains a text_area (e.g. a description of the book) and a date_select (e.g. when the book was published). <% for @book in @author.books %> <%= text_area ''book[]'', ''note'' %> <%= datetime_select
2006 Jun 12
2
date_select() in collection
Hi, I am doing the following: <% obj.contracts.each do |@contract| -%> ... <%= hidden_field("contract[]", :contractor_id, :index => @contract.contractor.id) %> <%= date_select("contract[]", :starting_on, :index => @contract.contractor.id) %> ... <% end -%> Here are the request parameters: {"commit"=>"Save",
2006 May 02
3
Ordering Results returned by has_many relationship.
Noob Question 31,265,232 if I''m searching on an object, say order, that has many "order_lines" and I want to display order lines by Quantity ( an attribute of the order_lines ) descending how could I do that without having to do a find() with :order, but something like; Order.order_lines.each do |ol| <!-- code to diplay the line --> how can I determine the field
2011 Jun 04
0
Rails 3.1 : Complex database query with Arel 2
Hi, I''ve search for documentations on queries with Arel 2 but there is pretty nothing and all I''ve found is for Arel 1 so I''ve run into NoMethodError: undefined method `[]'' for #<Arel::SelectManager:0x00000003f1b820> errors with join syntax. My query is barely simple but involve nesting queries. I have 4 tables. Assets, Deposits, Orders and OrderLines
2006 Jun 06
3
Invoice and invoice_lines
Hello People, I have a possibly very lame question. I am fairly new to RoR, and I want to make sure I do it "right". I have a model called Invoice, and one called InvoiceLines. Usual story: the table "invoice" has a 1:n relationship with "invoice_lines", which includes invoice_id. Now... the application will have a "new order" button, which will allow
2006 Jan 19
2
date_select broken
I am using date_select and in some instances it only shows about 10 years worth of choices. Same form on other users shows the whole range. date_select looks like this <%= date_select ''user'',''birthdate'' , :start_year => 1940 %> I would expect to always see 1940-2006 or so , but i dont always do. Is there a way to force the range or explain why i
2007 Apr 25
2
form_remote_for, reloaded
Hi, being relativly new to RoR, I''m having a problem which I found described in this forum and somewhere else - but with no solution. I know, that it may be bad to mix table and form tags, but the first solution of an in place editing within a table looked nice: Version using form_for: <tr> <%form_for :time_record, :url => { :action => "add_time_record" } do
2008 Oct 21
1
How to force a lock_version increment
Hi everyone, I have a order with order_lines use case. On changing the lines, I want to be sure no one else changed the order. So I use lock_version on the order. This works fine if something is changed on the order record. But now i have the situation that I delete, alter and add order lines without changing the order record itself. I have to check and increment the order#lock_version however
2005 Dec 15
1
date_select help
I''m trying to select items from a database by their date field. The date data is coming from a form using the date_select helper. The field in the database is named date_notified_on. My controller method is this: def history_date if(@params) @notifications = Notification.find(:all, :conditions => ["date_notified_on = ?",
2005 Feb 15
5
date_select where to add "class"=>"something"
Hi, I''ve looked on api.rubyonrails.org but I''ve not found how to add to a date_select(object, method, options = {}) a class option to set the class of all the select tags. I''ve tried using "class" => "myclass" in thoose ways: <%= date_select("costo", "data", "class" => "testo" ) %> <%=
2006 Jul 24
2
BIG JS limit? Using replace_html with partials containing JS
Hello, It''s pretty hard giving a practical example on this one. I have a partial which contains some generated Javascript. Something like: order_screen.rhtml ------------------------------------------- <h1>Order</h1> <div id="order_part"> <%=render :partial=>''order_new'' %> </div> <h1>Ordered products</h1>
2006 Mar 21
2
Validation to make sure associations don''t change?
I have a main form representing the model, let''s call that ''Order'', and a partial displaying its'' OrderLines. I use the bulk update methods to initialize model objects directly from form data, leaving validation of business logic to the model. As AR likes to write stuff before i do an explicit save, I wrap the whole update in a manual transaction. This works
2006 May 09
0
Problem with date_select
Dates defined chosen with date_select are not coming through once the form is submitted. I have this in a form: <%= date_select ''search'', ''date_start'', :include_blank => true %> <%= date_select ''search'', ''date_end'' , :include_blank => true %> However, when I submit the form params[:search][:date_start]
2006 Apr 04
0
Does observe_field work with date_select?
I can''t get observe_field to do anything with my date_select. Here''s the rhtml code: <%= date_select ''course'', ''lab_start_date'' %> <%= observe_field(:course_lab_start_date, :frequency => 0.5, :update => :course_lab_start_date_div, :url => { :action => ''preview_text''}) %> My
2008 Jun 17
0
how to set tabindex in date_select
<%= date_select(''user'', ''birthdate'', { :start_year => 80.years.ago.year, :end_year => 12.years.ago.year } ) %> work in rails 1.2.2 date_select(object_name, method, options = {}) I try many times but also didn''t know how to set tabindex in date_select --~--~---------~--~----~------------~-------~--~----~ You received this message
2005 Sep 16
0
Specify attributes for 'date_select' select inputs
Hi, I could not find an easy way to specify the ''id'' attribute for select inputs of ''date_select'' form helper. I need to set it because I want to retrieve date selects values from a javascript. <%= date_select ''product'', ''expiration'' %> generates <select name="product[expiration(1i)]">
2008 Jun 26
2
Problem with date_select after Rails 2.1 upgrade
Folks, I think I should start a new thread for this, because a similar one I saw is a bit old and the resolution there doesn''t seem to apply to what I''m running into now. Anyway, my date_select calls are bombing on me with the exception: ---- ActionView::TemplateError (wrong number of arguments (3 for 2)) on line #8 of entries/_dates_form.haml: 8: = date_select(