Ruby on Rails Saturday, December 1, 2012

On Sat, Dec 1, 2012 at 6:49 AM, Bhimasen Routray
<bhimasen.routray@gmail.com> wrote:
> error signalexception sigterm in heroku rails.. how to solve it..anybody can
> help me?

What are we supposed to help with? Because you sent absolutely no
useful information, exception names are dime a dozen in most apps
because people don't make them useful, how about more information?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Hi,
 I have two models named Customer and Order.

Customer < ActiveRecord::Base
has_many :orders
end

Order < ActiveRecord::Base
belongs_to :customer
end

Customer model has attributes like first_name and last_name. Order has customer_id along with other attributes.

Now, I want Customer first_name for specific order. I can get it with following query.

Customer.joins(:orders).where('orders.id = 1').select('first_name').

But, how to get it along with attributes of order table also. Say, I want both customers first_name and orders table created_at value.
When I try,
Order.includes(:customer).select('orders.created_at, customers.first_name')
this returns only order table records. What is the best way to select attributes of joined tables also with Active Record Query.

Thanks.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/ueZg0GTIwiUJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Hello everybody,

I am somehow new in ruby&watir. All i want to do today its to fill a
form, and 2 fields are taken from 2 different files.(urlimages.txt and
title.txt) like you see in attACHMENT. After
all fields are filled will be hit the "upload" button. After this, the
2 fields (url images and titles) will be again filled with second line
from each file),press upload button,after this will be filled with 3th
line from each file...and soo on till the end of file lenght,assuming
that
booth have the same numbers of lines.

My tactic:i tried to open each file with file.open, after this:
file.readlines() then make a loop to read each line of files and fill
the fields, then click submit. BUT...because are 2 files i find hard to
fill the form (source_title and image_url_input) without losing the
readlines counter.I mean every time will be read first line of each
file,i dont want this.
What should i do? to create a global variable that will be the counter
of lines from files? please help!





here its my code:

require 'rubygems'
require 'watir'
Watir::Browser.default = "firefox"
goto_url("http://www.imgfave.com/post")
browser.text_field(:name,
"source_title").set("_line_from_C\:\\title.txt")
browser.text_field(:id,
"image_url_input").set("_line_from_C\:\\urlimages.txt")
browser.text_field(:name, "tags").set("funny images")
browser.text_field(:name, "source_url").set("http://www.9gag.com")
browser.button(:value,"Upload").click

Attachments:
http://www.ruby-forum.com/attachment/7916/watir.PNG


--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.