Displaying 9 results from an estimated 9 matches for "matthewcollins".
2006 Feb 05
2
render partial, object.property missing
trying to do my first rails app (surprise, it''s a blog!)
anyhow.
in list.rhtml, i have this:
<% for post in @posts
render(:partial => "post", :object=>post)
end %>
and in _post.rhtml, i have:
<tr>
<td><%= post.title%>
<br />
<%= post.body%>
<br />
problem is, no content shows up -- displays a
2006 Feb 19
8
select, first option empty value?
using the below:
<%= select(''project'', ''project_type_id'', @project_types.collect {|x|
[x.name,x.id]}, {:include_blank => true}) %>
but i''d like that first option to have something like "select project
type" with an empty value?
2006 Feb 05
6
render partial -- show certain content only if...
i''m working on a _post.rhtml partial, and it displays one blog post.
i''m accessing this partial on the list.rhtml and the show.rhtml
what i''d like is to only show the "link" link on the list.rhtml and not
on the show page.
<%= post.title%>
<br />
<%= post.body%>
<%= link_to
2006 Feb 05
2
accessing the values in a view
trying to build an archive page
in the controller layout file, i render_component(:action => "archive"),
and that works fine. i turned render(:layout => false) within the
"archive" function.
trouble is, and here''s my confusion. as a test, i simply write
def archive
render(:layout => false)
@archives = ''test''
end
2006 Mar 03
2
strip html
say i wanted to allow only certain html characters from my user
submissions, and strip everything else. does rails have a built-in for
this?
2006 Feb 05
1
return yr/mo archive of posts
looking at ways to return an archive, by year/month
in the past, (via php) i''d do something like pull all the entries,
ordered by date and iterate through them, doing a check on the month and
year and adding them to an array if there was a change
that method doesn''t really feel very fluid or rails-like.
any suggestions?
2006 Feb 17
1
redirect error on componenet
ok, i''ve done a render_component(:controller => "user", :action =>
"user_menu"); user_menu checks for session id, if does not exist,
render_component(:controller => "user", :action => "login") [all of this
is working fine, thanks]. when i try to login, the form action goes to
login_user, which tries to login via the User model and
2006 Feb 18
4
verifying best practice
i have a Project model, which belongs_to :user
when i add a project, the users_id is based on the session[:users_id].
to get the users_id into the projects table, i''m doing this:
@project = Project.new(params[:project])
@project.users_id = session[:users_id]
this is working, i''m just verifying this is the best way to do it.
2006 Feb 24
4
too many components?
okay.
on /posts/show/13
i have show.rhtml, which does
render_component(:controller=>''comments'', :action=>''display_comments'',
:id=>post.id)
on comments/display_comments
i iterate through the comments and then, display_comments.rhtml
render_component(:controller=>''comments'', :action=>''new'', :id=>@id)