Jump to content

The ultimate community for Ruby on Rails developers.


Rails with MongoDB

Rails Ruby MongoDB Json Bson mongoid rubyonrails

  • Please log in to reply
No replies to this topic

#1 vignesh_viki



  • Members
  • 1 posts

Posted 09 March 2014 - 06:19 AM

Hello viewers .. I'm Doing a project on rails with mongoDB as a backend database. When we learn a new programming language we start with writing a helloworld program . In the same way if we want to work with a web application we usually do a simple database connection .. We just create a page with a single text box and a simple button . When we click the button the data should be fetched from a database and showed in the textbox . or otherwise when clicked the data in textbox should be sent to the backend db . this is what we do . And i went through the same . Used this tutorial "http://moredevideas....4-with-mongodb/"  Its really superb . And i really executed it well and got it working . As per the tutorial i executed the command

"rails generate scaffold product name description price:float"  ..

It generated some of the files in the app/view folder and one the file named "index.json.jbuilder" . And the file contains this code

"json.array!(@products) do |product|
  json.extract! product, :id, :name, :description, :price
  json.url product_url(product, format: :json)
end" ..

What does this code actually mean.i'm not able to understand it.. Any suggestions would be helpful .

Also tagged with one or more of these keywords: Rails, Ruby, MongoDB, Json, Bson, mongoid, rubyonrails

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users