similar to: Best practices for conditional display in views?

Displaying 20 results from an estimated 800 matches similar to: "Best practices for conditional display in views?"

2007 Jan 03
2
error_message_on broken?
Hi, in my app, using the error_message_on form helper like this: <label for="user_name">User name:</label> <%= error_message_on ''user'', :name %> <%= f.text_field :name %> generates the following error: undefined method `errors'' for :user:Symbol I am using edge revision 5813 and the simply_helpful plugin. Is there a way to fix this?
2005 Dec 23
1
Overloading error_message_on method in ActiveRecordHelper
Hello all I would like to overload the error_message_on method in the ActiveRecordHelper module in order to emit a span tag instead of a div tag. I try to achieve this by way of plugins: Under vendor/plugins I''ve made a error_messages_on_fix directory, containing init.rb like this: --- require ''active_record_helper_fix'' --- ..and a lib directory with
2009 Jul 07
10
link_to, how do you combine url options and html_options?
I have a link-to that I wish to look somewhat like this: link_to "link here", new_object_path, :method => :post, :confirm => ''Press OK'', #url options :class => "css_class", :id => "css_id" #html options In any case I can either get the url_for options to work or the html options to work, but
2006 Dec 14
12
Saving dates
Hi having trouble saving dates in my form i have the following in the view <%= date_select("details", "open_date") %> and i have @exhibition.open_date = params[:details][:open_date] and then @exhibition.save All the other values form (not seen here) get saved but not the dates. What am i doing wrong ? -- Posted via http://www.ruby-forum.com/.
2006 Jul 23
8
destroy vs delete
what is the difference between destroy and delete in AR I am not sure what they mean by "Destroys the record with the given id by instantiating the object and calling destroy<http://api.rubyonrails.com/classes/ActiveRecord/Base.html#M000866>(all the callbacks are the triggered). If an array of ids is provided, all of them are destroyed." in
2009 Apr 08
4
Having trouble extending a class from a Rails plugin
I have class in a plugin that I want to crack open and add some functionality to for a particular application. So, I created a file by the same name as the class in my app/models folder and added some methods to the class, but, I can''t seem to get Rails (2.2.2) to pick-up the extended definition. I did find while trying to debug the problem that if I paste the extended definition into,
2007 Sep 30
2
Outputing to the browser, how?
Hello, I''m writting some helper methods to write forms, so I have this working code: class TableFormBuilder < ActionView::Helpers::FormBuilder ["file_field", "password_field", "text_field"].each do |name| define_method(name) do |label, *args| @template.content_tag(:tr, @template.content_tag(:td, @template.content_tag(:label,
2010 Nov 16
15
acts_as_taggable, undefined method 'empty?'
I''ve tried out ''acts_as_taggable'', ''acts_as_taggable_on'' and ''acts_as_taggable_on_steroids'' and all of them output "undefined method ''empty?''" with the tag_cloud action. I am following the guides precisely. Yet I can find no references to this error anywhere, so I must be doing something wrong... I am on
2006 Feb 16
3
Retrieve a property defined in a css
Hi all, I have a property, defined in an external stylesheet: .my_class { background-color: #FF0000; } I want to retrieve the value of this background-color of the class my_class. How can I do that with prototype/scriptaculous ? Thanks in advance, Nicolas Terray
2008 Feb 19
3
render_to_string in a controller test?
Hi all, I know that in general, view and controller tests should be isolated, such that controller specs don''t test views etc. However, I think I''ve run into a situation that might be an exception. My controller uses render_to_string to produce a chunk of HTML that it passes to a model to be processed. The controller then redirects the user to a different page. The
2007 Apr 19
4
render_to_string in a model ?
I have a batch job that will call script/runner, I would like in this call to create html formated email and save it to the database. This is easy enough in a controller with yournewhost.email = render_to_string :action => "email_newhost_ready", :layout => false But render_to_string is only available in controller action pack, is there a easy way to render_to_string in a Model? Or
2006 Jun 19
2
content_tag question
Am trying to insert a link to delete via ajax in my RJS template. Can one use content_tag and link_to_remote like this in a RJS template? a = content_tag(''a'', link_to_remote("Delete", :update => "categories", :url => {:action => "delete", :name => category.name})) -Thanks. -- Posted via http://www.ruby-forum.com/.
2007 Nov 30
5
render_to_string in an after filter
I''m using render_to_string in an after_filter, which renders a partial that is sent to a web service. Here''s the code: class MyController < ApplicationController after_filter :post_to_webservice def show # show logic end def post_to_webservice stuff = render_to_string :partial => ''stuff'' webservice_post(stuff) end I get a DoubleRenderError in the
2007 Nov 10
3
Wrapper Helper Help Please
Hi all. I''m hoping this is a simple one that someone can put me right on. I have a view that ''wraps'' some div''s around a Page Header and Page Content, for formatting reasons: <div id="LHS"> <div class="Page"> <div class="PageHeader"> ''Header Here'' </div> <div
2006 May 26
8
calling render_to_string outside of controller
How can I call render_to_string outside of a controller. I''m stuck on this. I''ve nearly got my plugin finished but I can''t seem to get this to work. The method is in ActionController::Base but it is protected. -- Posted via http://www.ruby-forum.com/.
2007 Nov 25
2
Fwd: Render_to_string from a worker
Hi, I am trying to generate a PDF from within a worker using PDF::Writer. In my controller I use render_to_string to create the pdf file however from what I understand render_to_string can only be used from a controller. Does anybody have any suggestions how I might be able to replicate this functionality in a worker? -- thanks, Felix -------------- next part -------------- An HTML attachment
2008 Dec 11
1
help needed regaring Acts As Taggable On Steroids
Hello, In my rails application, I have a book model. I want to add tags. For that I have installed acts_as_taggable_on_steroids from this link http://agilewebdevelopment.com/plugins/acts_as_taggable_on_steroids and do as the readme file. This is my Model : class Book < ActiveRecord::Base acts_as_taggable end Here is my ApplicationHelper : module
2006 Apr 11
1
content_tag can not work?
the tag helper "content_tag" can not work correnctedly on my enviroment: page.insert_html :bottom, ''body'', content_tag("div","id"=>"tag") then in body,i can only get "idtag" as the text! but if i use : content_tag("p","hello world") I can get it worked. From the rails 1.1 api document,i can find the
2008 Mar 31
2
Rails and Partials
Excuse my ignorance on partials but..... I am trying to use partials to create a uniform display box built with html tables. The only way I have thought about accomplishing this is to create two partials: _start_box.erb ---------------- <table id="box" width="<%= width %>"><tr><th><%= h(label_text) %></th></tr><tr><td>
2012 May 28
1
rendering a partial inside another using render_to_string and (:formats) in controller
I want to clean my code by moving the duplicated lines : partial = render_to_string( :partial => "#{file}", :formats => [:html] ) to the pagination_partials function. ================================================= WORKING CODE: ================================================= def render_format_search_partial(file, options={}) # TODO remove this line to use the one