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.com/getting-started-rails-4-wi... 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 .
on 2014-03-09 07:26
on 2014-03-09 17:14
On Sunday, March 9, 2014 1:26:02 AM UTC-5, Ruby-Forum.com User wrote: > "http://moredevideas.com/getting-started-rails-4-wi... Its > 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 . > > -- > Posted via http://www.ruby-forum.com/. > The code is syntax for the DSL for the jbuilder gem. You can view the documentation at: https://github.com/rails/jbuilder