asp.net mvc - Does creating a RESTful API with rails follow an MVC Architecture? -


an application assigned uses asp.net mvc framework ui layer. got me thinking ruby on rails , it's mvc architecture well.

when helped build restful api rails didn't use view... controller restful endpoint , model.

does mean restful endpoint built on rails not follow mvc architecture though rails supposedly does?

or fact rails follows mvc architecture mean restful endpoint built on rails follows mvc framework though there isn't view?

i wonder because current application uses asp.net mvc framework it's ui, yet has view , controller, , makes ajax calls web services data display. thought myself didn't follow mvc structure, led me after thought.

your rails api still mvc. "view" component generated implicitly, speak. is, rails uses set of default behaviors generating implicit views. in api, example, if use respond_to :json , respond_with(@my_object) json "view" auto-generated response @my_object.to_json. can override "view" overriding @my_object.as_json method... or can fancy , add presenter layer object , have generate json "view" code. either way, it's still mvc if don't have explicit view template time.

also, rails gems exist, such rabl, make "view" component/approach more explicit if style.


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -