Ruby on Rails SQlite 3 database query -


i have been looking online how queries ruby on rails , can find information how build query not put physical code. new ruby on rails.

i have 1 database called story , has title , content columns made. have page used input title , content , stored database , have page displays contents of database not understand how query find let's say, "a record has content or title contains word or phrase"

   <%= @story.content %> 

so understand displays content on screen, same thing queries?

in rails active records used not direct sql queries

here's link explains ......

http://guides.rubyonrails.org/active_record_querying.html

for example lets have post model , want

  1. index posts use

    @posts = post.all

  2. you want show specific post ,find id

    @post = post.find(params[:id])

  3. create new post

    @post = post.new


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -