Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I want to know about following concepts:

I have a model named MyModelName. I am using postgres database server and rails-3. I want to do some task with it as mentioned below-

@ruby_variable_1 = MyModelName.where(:field_name_1 => value_on_field)
@ruby_variable_2 = @ruby_variable_1.where(:field_name_2 => value_on_field)

I want to use 2nd variable which is recordset of my model (here MyModelName), So please tell me how to do it.

I tried on sandbox and getting this error
I know this is possible but how

I have its alternate way also via loop, but I don't want to use that as it is not a good concepts.

NoMethodError: undefined method `where' for Array:0x00000004e32c00

share|improve this question
1  
This is off topic here and should be migrated to StackOverflow (admins will migrate, so please don't double post) – thorsten müller Apr 3 at 12:49
Hello and Welcome to Programmers. Please read the faq as implementation specific questions are off-topic here. Please do not try to circumvent question bans on Stack Overflow by posting here. Instead read this. Have a please day. – World Engineer Apr 3 at 12:58

closed as off topic by thorsten müller, World Engineer Apr 3 at 12:56

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.