> On Jul 3, 2018, at 9:45 AM, Stephanie_Snowflake <spicychemist@gmail.com> wrote:
>
> #film.rb
> def self.to_csv(options = {})
> CSV.generate(options) do |csv|
> csv << %w(Serial Formula Width Length Area Shelf SO Phase)
> all.join_dimensions.each do |f|
> csv << [f.serial, f.formula, f.width, f.length, f.area, f.shelf, f.sales_order_code, f.phase]
> end
> end
> end
>
>
> #film_movement.rb
> def self.to_csv(options = {})
> CSV.generate(options) do |csv|
> csv << %w(Serial Formula Width Length Order User DateTime)
> all.each do |m|
> csv << [m.serial, m.formula, m.width, m.length, m.sales_order_code, m.created_at]
> end
> end
> end
> end
>
> line_item.rb
> def self.to_csv(options = {})
> CSV.generate(options) do |csv|
> csv << %w(SO# Type Custom-W Custom-L Pieces Wires Busbars Note)
> all.each do |o|
> csv << [o.sales_order_code, o.product_type, o.custom_width, o.custom_length, o.quantity, o.wire_length, o.busbar_type, o.note]
> end
> end
> end
>
> #master_films.rb
> def self.to_csv(options = {})
> types = defect_types
> CSV.generate(options) do |csv|
> csv << %w(Serial Formula Mix/g Machine ITO Thinky b* Chemist Operator Inspector EffW EffL) + types
> all.each do |mf|
> csv << [mf.serial, mf.formula, mf.mix_mass, mf.machine_code, mf.film_code_top, mf.thinky_code, mf.b_value, mf.chemist, mf.operator, mf.inspector, mf.effective_width, mf.effective_length, mf.yield] + types.map{ |type| mf.defect_count(type) }
> end
> end
> end
>
> #sales_order.rb
> def self.to_csv(options = {})
> CSV.generate(options) do |csv|
> csv << %w(SO# Customer Released Due Ship-to Status Shipped Note)
> all.each do |o|
> csv << [o.code, o.customer, o.release_date, o.due_date, o.ship_to, o.status, o.ship_date, o.note]
> end
> end
> end
>
> Is there documentation for this fav_params?
I'm not sure what your question refers to. There's no other instance of fav_params in the code you've quoted here. These are all models, not controllers, and models don't have access to the params. Read the Rails Guide about Strong Parameters. Start here: http://guides.rubyonrails.org and pick the version of Rails you are currently stuck in. You have to define the rules of the road for your application. Rails 2.3 used to do this with a macro in the model called attr_accessible. This changed to strong parameters (in the controller) in Rails 4.
Walter
>
> --
> 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 rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3af261b8-d08c-4fba-8da3-96c6c4c70043%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/52D0C67A-8588-4AD1-B597-C0B3AF6F2A61%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment