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