rails 3 displaying a where -


Using the code given below, I can search the table using the question id and state where the position will be the largest number < / P>

  & lt;% = @question = Question.where ('question_group_id' = & gt; parameter [: question_group_id]). Order (parameter [: status]). Previous & gt;  

However, I get

  # & lt; Question: 0x3fe85c0 & gt;  

How do I display it with real status number

thanks

I know that this may be a post but let me or Respond to these boards related to three different questions where the user got the same result, but they did not help

Do this in your controller:

  @question = Question.where ('question_group_id' = & gt; parameter [: question_group_id]) Order (parameter [: status]). Last  

and you can use this part in your part to show all the features

  <% = @ question.inspect% & Gt;  

or to show a feature that you can use

  <% = @ question.position%>  

Please note that when you do this, & lt;% =%> tag, it automatically does a to_s , so you can see more wordpress printed in your console when you check whether the @question that will actually appear, try @quest.to_s

(Also keep in mind that the quality will not be available in the console, but you can copy and paste the relevant code Can)


Comments