Displaying 6 results from an estimated 6 matches for "div_for".
2010 Oct 16
0
HTML5 Data Attributes
...tition.
To create, for example, this:
<div class="user" data-
location="{"city":"Chicago","state":"Illinois"}"
data-name="Stephen" id="user_1">
You would do something like this:
div_for user, ''data-name'' => user.name, ''data-location'' => { city:
user.city, state: user.state }.to_json do # ...
Here''s a proposed simplification, using a single "data" node to define
the attributes:
div_for user, data: { name: user.name, loc...
2009 Mar 11
12
Eager loading comments associated with user submissions.
Hey everyone,
I am working on an application that allows users to submit articles,
and also comment on those articles. Pretty much exactly like Digg.
Everything works fine except that when there are a lot of comments
there are a lot of database queries to both fetch the comments and the
users who posted those comments. I have used eager loading in other
parts of my application to reduce the
2009 Sep 30
8
Cycle/Partials issue
...mple but
I''m just learning the ropes :)
So I have a simple blog app where a post has many comments. The ''show''
view for posts renders a partial for each comment the post has. The css
class of the containing div element is cycled using cycle(). The partial
code is,
<% div_for(comment, :class => cycle("blue","white")) do %>
<p><span class=''commentdate''><%=
comment.created_at.strftime("#{comment.created_at.day.ordinalize} %b
%Y") %></span>
<strong><%= h(comment.name) %></strong>...
2008 Jun 06
0
in_place_editor_field in Rails 2.0.2
I''m attempting to get an in_place_editor_field working in my index
view. I have the following:
index.html.erb
<% for profile in @profiles %>
<% div_for(profile) do %>
<% @profile = profile %>
<%= in_place_editor_field(:profile, :first_name) %>
<% end %>
<% end %>
profiles_controller.rb
def index
@profiles = Profile.find(:all)
respond_to do |format|
format.html
end
end
At one point I read something a...
2010 Jan 05
0
Problem with associating comments with blog posts on same page
...omment.new] do |f| %>
This successfully pulls the post id and saves the comment as belonging
to that post.
Now, when I try to incorporate everything all into a very easy page to
navigate I can''t use the same code associations and my comments fail.
app/views/posts/index.html.erb
<% div_for( post ) do %>
<h3><%= link_to_unless_current h(post.title), statemant %></h3>
<p class="timestamp">
Posted <%=h time_ago_in_words(post.created_at) %> ago
</p>
<p>
Approved: <%= h(post.approved) %>
</p>
<p class="post_p...
2008 Jan 23
11
Rails 2.0.2 + RJS
Hi
I had ajax commenting on my app, which worked perfectly on Rails
v1.2.6, but does not work the same in Rails 2.02. Basically the
comment gets added, but the visual effects do not work (ie lines 2 + 3
of create.rjs)
create.js
page.insert_html :bottom, ''comments'', :partial => ''comment''
page.visual_effect :appear, "comment_#{@comment.id}"