Santosh Yadav
Santosh Yadav

Reputation: 51

How to create Models in Rails and pass data from models to controller

I am new to rails. I have created controller and able to see changes in http://127.0.0.1:3000/.

How to create Models in Rails and pass data from models to controller.

Upvotes: 0

Views: 47

Answers (1)

Script-Kiddie
Script-Kiddie

Reputation: 69

If you need to access a controller variable from a model it generally means your design is wrong because a controller serves as bridge between view and model (at least in Rails), controller gets info from models, models shouldn't know anything about controllers, but if you want to do it anyway. For your first question you can simply create models in rails as rails g model MODELNAME g as short of generate

Upvotes: 2

Related Questions