rails with mongodb

47 views
Skip to first unread message

Vignesh Gopalakrishnan

unread,
Mar 9, 2014, 1:26:02 AM3/9/14
to rubyonra...@googlegroups.com
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-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 .

--
Posted via http://www.ruby-forum.com/.

mike

unread,
Mar 9, 2014, 12:13:35 PM3/9/14
to rubyonra...@googlegroups.com
The code is syntax for the DSL for the jbuilder gem.  You can view the documentation at:


 

Vignesh Gopalakrishnan

unread,
Mar 10, 2014, 7:37:46 AM3/10/14
to rubyonra...@googlegroups.com
> The code is syntax for the DSL for the jbuilder gem. You can view the
> documentation at:
>
> https://github.com/rails/jbuilder


Thank you Mike ..
Reply all
Reply to author
Forward
0 new messages