alexsunny

Joined

800 Experience
0 Lessons Completed
1 Question Solved

Activity

Hello,

I just finished going over Chris's two great railscasts dealing with search. However, I wanted to put my search bar on my navbar so that whenever someone searches the results I will be taken to my search.html.erb within my books folder (similar to how Gorails works). https://chatrandom.live https://topdatingwebsitesx.com/chatrandom https://topdatingwebsitesx.com/camsurf I ran into an issue though, everytime I did a search I was taken to my books page with no results being shown just my standard index showing all my books and was never taken to my search results page. I've listed all my relevant code below. If anyone can help me out would be super grateful.

thanks
alexsunny

Posted in Multiple select for CSV Export?..

Hello,

My users can create a report record which is basically a scaffolded model "Report" with controller and views. The users can use this model to create records that a CSV method is using to query 2 other models: Order (parent) model and the corresponding Sale (child).

The Report model contains these columns:

t.datetime "start" (for createdat between (?) and (?))
t.datetime "end" (for createdat between (?) and (?))
t.string "brand" (brand = ?)
t.string "team" (team = ?)
Short excerpt of the CSV query looks like that:

Order.where("created_at between (?) and (?) and brand = ? and team = ?", self.start, self.end, self.brand, self.team).each do |order| order.sales.each do |sale|

This basically outputs each single Sale record in one line. So when 1 Order contains 5 sales, then 5 rows are printed into the CSV file.
That works perfectly with a single brand and a single team.

Now I want to do offer my users multiple select of brands and teams. E.g. when the brand is "Adidas" and "Nike" and the corresponding teams are "US" and "Europe" I want to put both outputs into one CSV instead having the user to create 2 reports.

I'm really struggling with that. What do I need to adjust so that multiple values are getting saved into one record, like brand = "Adidas, Nike" and team = "US, Europe" and then have this array parsed and get that into the CSV AR Query.

thanks
alexsunny