Questions tagged [partials]

Partials are often synonym for templates, which can even also be called partial templates.

Partials are often synonym for templates, which can even also be called partial templates.

763 questions
5
votes
2 answers

Variable passing to use path in partial

I'm learning Ruby on Rails by using this book. I'm stuck on the second exercise from here. My form partial app/views/users/_form.html.erb looks like this: <%= form_for(@user, url: yield(:path)) do |f| %> <%= render 'shared/error_messages', object:…
ronatory
  • 7,156
  • 4
  • 29
  • 49
5
votes
2 answers

How to render a Partial from a Model in Rails 2.3.5

I have a Rails 2.3.5 application and Im trying to render several Partials from within a Model (i know, i know -- im not supposed to). The reason im doing this is im integrating a Comet server (APE) into my Rails app and need to push updates out…
empire29
  • 3,729
  • 6
  • 45
  • 71
5
votes
1 answer

spullara mustache java partials

I'm having trouble finding examples of how to implement partials using the Spullara Mustache java implementation. Their github page doesn't seem to have any straight forward partial examples. In DefaultMustacheFactory I see methods for…
Matt Ashley
  • 115
  • 7
5
votes
5 answers

Rails render partial in a loop

I am new to rails and I am trying to render a partial within a loop as such. Here , books is an array eager loaded in controller. books.each do |book| <%= render 'books/book', :book => book %> end This works fine. But when the books array is…
testsum
  • 51
  • 1
  • 2
5
votes
2 answers

How to find where a view partial is used?

How do you go about easily finding out where a Rails view partial is used? In what views, controllers etc. This is handy when working on an app that someone else wrote. You don't necessarily know what views are using a particular partial, or where…
Magne
  • 16,401
  • 10
  • 68
  • 88
5
votes
2 answers

Passing variables to handlebars partials in Ember.js

What I want to do should be fairly simple. I want to pass variables to partials for reusability. I want to do something like this :
{{partial 'components/field-email' label="Email"…
Jim
  • 1,062
  • 11
  • 24
5
votes
2 answers

Two-part Rails layouts

My web pages consist of two parts, let's say top and bottom (except header and footer -- those are consistent across pages). What is the best practice to dynamically generate those parts depending on the action? One approach I have come up with is…
Pavel Bastov
  • 6,911
  • 7
  • 39
  • 48
5
votes
2 answers

Rails is Looking for a Partial in the Wrong Directory

I have a polymorphic Review model. The namespaced model User::Library::Publication is reviewable. The reviews are created properly, but when I try to display them through a partial, Rails looks up the wrong directory. In my view: <%= render @review…
nullnullnull
  • 8,039
  • 12
  • 55
  • 107
5
votes
1 answer

Passing local variable to partial inside for each loop rails 3

This is my code for rendering the partial (the @parties collection is being generated correctly, I have tested that): <% @parties.each do |party| %>
<%= render 'parties/party', :object => party …
nicohvi
  • 2,270
  • 2
  • 28
  • 42
4
votes
1 answer

Rendering partials in rabl

I am using RABL to format the output of a Rails API. I tried following code message.rabl: object @message attributes :id,:description,:created_at,:created_by_user_id child @comments do |t| partial("user/comment", :object =>…
nilkash
  • 7,408
  • 32
  • 99
  • 176
4
votes
2 answers

How can I use TypeScript Partials to test AWS Lambda?

Very similar to Using partial shape for unit testing with typescript but I'm failing to understand why the Partial type is seen as being incompatible with the full version. I have a unit test which check if a lambda returns 400 if the body in an AWS…
mikemaccana
  • 110,530
  • 99
  • 389
  • 494
4
votes
1 answer

Dynamic content with fields_for

I have a nested form that uses a has_many relationship. In my form view, I use a partial for the field inputs and pass along the FormBuilder object. form.html.haml: - form_for @record do |f| .field = container do - f.fields_for :strings…
Daniel Vandersluis
  • 91,582
  • 23
  • 169
  • 153
4
votes
0 answers

handlebars dynamic update partial only

I work in a Phonegap project, with Handlebars, and can't find an answer for this. I have a template like this (stripped)