I am new to rail and thought that I have finally figured out some of the routing material, but in the circles This is all the day going on
I am working with tutorials from the tutorial, but I am working with Mongo instead of my SQL.
I've got 3 types of pages, home page that shows all the posts ordered by date
Users page, which is showing posts from a specific user
A post page that is showing posts from users' friends
So for each page, I have done the following
1) To get the right post, one in the same controller Method is created
2) A built-in performance paramet The _posts.html.erb page with R, which is slightly different on each page
3) is referenced partially in the index.html.erb page for each view.
Controller entries appear like this
DIF index @ posts = post.All (: order => 'created DASC') termination
or
deaf post @posts = post.all ({'user_id' => parameter [: id]},: order => 'created_at dESC') end
and Partial
& lt;% = render: partial => @posts% & gt;
Each scene has a _posts.html.erb file, and each is slightly different
home / _posts.html. ARB looks like this
While posting / _post.html. ARB looks like this
<% = div_for post%> Posted by & lt;% = post.user_id% & gt; & Lt;% = post.text% & gt; & Lt;% if post.created_at> 52.hours.since% & gt; & Lt;% = distance_of_time_in_words_to_now (post.created_at)%> & Lt;% else% & gt; & Lt;% = post.created_at.strftime ("% c")%> & Lt;% end% & gt; & Lt;% end% & gt;The strange thing is now that all pages are index.html.erb, users / show.html.erb, posts / index.html.erb, part / post which is being displayed / postponed. Html.erb Others are being completely ignored.
My understanding was that rendering: will take partial @posts and _posts.html from the current view. But this is not happening because only posts / _post.html from all posts. Translation of ARB is being done.
I have seen in the roads. RB file, but there is nothing
----------- Edited ----- ---- -----------------------
The directory structure for the scenes is as follows:
view - home - _post.html .erb -index.htlm.erb - layout - post-_ post.html.erb-index.html.erb-posts.html.erb - session - user-_ post.html.erb -new.html .erb - Show.html.erbI hope that helps
Maybe the rail partially defines the path you only collect
Comments
Post a Comment