similar to: render partial -- show certain content only if...

Displaying 20 results from an estimated 10000 matches similar to: "render partial -- show certain content only if..."

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
2005 Dec 15
6
Navigation menu
I have a navigation menu that contains a link per controller in my application. This menu is the same for all controllers, but I want this behaviour: <a>Users</a> <span>Statistics</span> and <span>Users</span> <a>Statistics</a> depending on the page you''re currently on. I''ve put a <render :partial =>
2006 Jan 11
5
stack level too deep problem
Hi all, I''m trying to overload the link_to function, (to disable link_to if the user has no access right) this is my code, it work the first time I run the application, the second time I refresh the page I always get "stack level too deep error" module UsersHelper include ActionView::Helpers::UrlHelper alias_method :link_to_original, :link_to def permission? true
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 Jan 09
3
Scaffolding - disabling Create, Edit, Destroy for some user logins?
People, I am using: before_filter :login_required in my Controllers and this works fine. For some tables I am happy to use the output of eg: ruby script/generate scaffold Author but is there some way that I can disable Create, Edit, Destroy for some user logins in the corresponding view? Thanks, Phil. -- Philip Rhoades Pricom Pty Limited (ACN 003 252 275 ABN 91 003 252 275) GPO Box
2008 Mar 24
8
Proper idom for link_to_if
What I wish to do is to have a construct like this in a view: <%= link_to_if <some test>, "New Model View", new_model_path -%> <some test> has to return true if new_model_path is defined and false otherwise. What is the proper idiom to do this in rails 2? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received
2006 Jan 04
5
help with link_to_if, I can''t make it work...
For the life of me I can''t get it to work. Here is an example of my syntax. I''m trying to make comment.name a link to comment.web_site only if there is a comment.web_site. Can someone please help? <%= link_to_if(comment.web_site.length > 0, comment.name, comment.web_site {"class" => "comment_by"}) %> -- Posted via
2006 Apr 01
10
You have a nil object when you didn''t expect it!
Hi, I am creating a blog to learn ruby on rails. I have 2 different views/models/controllers, 1 called post and 1 called comments. How do i link a post from the views/post directory to the comments that belong to the post in the views/comment directory. This is the code in the post/show.rhtml <%= render :partial => "post", :object => @post %> <%= link_to
2006 Jan 30
14
RoR admin system
I''m preety new at RoR (and programming), I tried a few tutorials, and really like the RoR simplicity, but my knowledge of the framework still isn''t very good (to be true, i understand the basics, but not everything that''s in the tutorials). But still I''d like to create a website which has: - front end interface (with no edit functions) - admin interface
2005 Dec 27
7
help remove duplication in my app
I''m porting an old site of mine into Rails and I''m running into some duplication that could / needs to be weeded out. For each of my actions, I have to wrap the view content in the following HTML: <div class="box"> <img src="/images/content-top2.png" class="border" /> <div class="visible"> # content
2006 May 03
2
render partial collection
my view contains a call to a partial: <%= render(:partial => ''item_list'', :collection => @keyword.synonyms, :locals => { :action_delete => "removesynonym", and_some_other_stuff }) %> _item_list.rhtml contains: <%= link_to ( image_tag(''/images/deletebutton.png''), { :action => action_delete, :id =>
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 Apr 30
4
renamed partial won''t render?
hi all this works <%= render :partial => "admin/works/work", :collection => @artist.works %> but this doesn''t <%= render :partial => "admin/works/worklist", :collection => @artist.works %> even though the partial _work.rhtml and _worklist.rhtml are identical. worklist.rhtml throws undefined local variable or method
2006 Jan 10
5
No layout for specific method
Is there a way to not specify a layout for a particular method in a controller? In this particular instance, I am using the admin layout for the login controller, but I don''t want the layout to be used on the "login" method. Thanks, Dan
2006 Feb 08
2
Idiomatic way to change partial''s behavior based on caller
Guys, I have a partial that is shared by many controllers, and this partial has a link that needs to do different things based on which controller calls it. So, the partial looks like this: <!-- _part.rhtml --> <tr> <td><%=part.number%></td> <td><%=part.associated_part_number%></td> <td><%=part.drawings%></td>
2005 Dec 15
6
Code from famous RoR video?
Does anyone know where I could get text file with the code from the famous video where they create a Weblog in 15 minutes -- The one that''s here: href="http://rubyonrails.com/screencasts? (I can''t just watch it here at work, and I''d like to avoid having to re-type everything in any case.) Thanks! -- Posted via http://www.ruby-forum.com/.
2006 Aug 18
3
equivalent of "puts" in rhtml
Hi everyone, This seems so basic, and yet I can''t quite figure it out. Say I have some code in an .rhtml document: <%= if @session[:user_id] link_to somethingA else link_to somethingB link_to somethingC end -%> Only the link to somethingC will show in the second case. I understand that the last thing returned from that else block is that last line. In php i could just add
2006 Mar 27
2
Trouble with rendering partials
This only works when the partial name matches the object name; if I change "threadtop" to "thread" then it works fine. Is this normal? I get the following error otherwise: "undefined local variable or method `thread''" index.rhtml --- <% for @thread in @threads %> <%= render :partial => ''threadtop'', :object => @thread
2007 Oct 06
4
spec''ing views, mock_model associations
I writing a spec that returns the count of how many players in a game: it "should how many players in a link to all players" do render :partial =>"games/game", :object => @game response.should have_tag(''a'',"(2) Players") end I''m not sure how to do the mock model, I think it would be done two ways but unsure of the syntax: 1: add
2005 Aug 15
2
Newbie rendering problem
Hi On every list request i render an item partial through a collection of items. the item table has 3 columns namely name,anotherName and id. the item partial looks like <%@item=item%> <%= error_messages_for(:item) %> <tr id="<%=item.id%>"> <% for column in Item.content_columns %> <td><%=h item.send(column.name) %></td> <%