similar to: how to output something from within <% %> tags?

Displaying 20 results from an estimated 8000 matches similar to: "how to output something from within <% %> tags?"

2006 Mar 02
3
How to identify the browser?
I need to generate some browser-specific code; can I identify which browser is being used from within my RoR code? -- Posted via http://www.ruby-forum.com/.
2006 Feb 21
5
how to include an html file?
I have a bunch of html files with partial page content. I''d like to be able to include the content of these files in my RoR views without having to change or rename them. In PHP I''d simply use include("file.html"); What is the RoR equivalent of this? render_file insists on it being an rhtml template, and render_partial requires me to rename the file. Ideally, I
2006 Feb 07
17
Easy way of dealing with nil properties in templates?
Is there an easy way to deal with nil properties in templates? All I''m aware of are these methods, and it''s quite tedious and surely violates DRY. <%= @member.name unless @member.name.nil? %> <%= @member.name.to_is %> <%= "#{@member.name}" %> csn __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the
2006 Mar 07
1
Access flash from a model class?
I have a method that returns either a comment stored in the flash (if it exists) or a new comment. It works when I put it in my application controller: def preform_comment if flash[:badcomment].nil? comment = Comment.new return comment else return flash[:badcomment] end end However it would be cleaner to put this in the Comment model, so I tried: def
2006 Feb 28
1
Can I let routes.rb take precedence over file names?
I''d like Rails to intercept the url''s of html pages in a certain directory so I can embed them in my site. I put them in public/pages and tried to catch them with a route like map.connect ''pages/:pagename'' However this only works if the file does not exist; e.g. "pages/test.html" will only be routed if that file doesn''t exist,
2006 Mar 07
2
redirect after validation
I have a difficulty with something that makes me think I don''t understand an aspect of Rails what. I''ve made a sort of blog site, and under each article I show the comments and a comment form. The comment model validates whether the user has entered his name. When he hasn''t, I want to send him back to the form with his comment text still there. In the comment/create
2006 Feb 21
6
Select articles from group with id ''1'' and id ''2''
I have to tables: "articles" and "groups". Between I have article_groups as a jointable. Now I want to select every article who is a member of group with id ''1'' and id ''2''. Whats best way to get that? Extract from schemas: CREATE TABLE articles ( id int auto_increment, ingress text NOT NULL, story_text longtext, constraint fk_items_users
2006 Apr 05
25
How to avoid bunch of <% %> ??
Hello, I would like to know is there is a way to avoid poluting the views with tons of <% %> ? Like this <%= start_form_tag() %> <%= text_field_tag(''category[title]'', category.title, {:size => 20, :maxlength => 128}) %> <% if not category.parent_id.nil? %> <%= select("category", "parent_id", Category.find(:all,
2006 Mar 09
5
link_to_remote id or class
Can anyone out there tell me how to add a class or id property to a link using link_to_remote? I''ve been banging my head on this for far too long. Thanks Clint
2005 Dec 27
13
<%= works, print doesn''t
In my views, for example list.rhtml, if I try: <%= "test" %> everything works fine. If I try: <% print "test" %> then instead of outputting the page, the browser displays the HTML source code. Any ideas on what my problem is? This is my first RoR app so it''s probably a stupid bug on my part, but my Google-fu isn''t powerful to track down
2005 Oct 14
7
validates_confirmation_of not working
Hello, I''m having a weird problem in my user model. For the change_password method I have the following: def change_password(oldpass, newpass, confirmation) oldpass = self.class.myhash(oldpass) reload passhash = self.password self.password = newpass self.password_confirmation = confirmation if valid? and oldpass == passhash save! else # valid?
2006 Aug 16
1
net user add disables remote account automatically?
I notice when issuing the command "net rpc user testuser -S ip_address -U administrator%password" that the testuser gets added to the remote machine (Win 2k3) sucessfully, however the account is disabled. After adding the user remotely it requires that the administrator log into the remote machine "ip_address" to enable the newly created account. Is there a way to add a user
2006 Mar 22
4
hivelogic lighttpd install
Hey group, I went through the Hivelogic install and it works great. Now I''d like to run lighttpd as a daemon, but when I go into the /usr/local folder where everything was installed, I don''t see a lighttpd directory where the config files would be. If I try "lighttpd start" from the command line, I get an error that says "No configuration file available".
2006 Feb 07
3
Newbie help ..
Hi .. I am new to Rails and it is not clear to me why I am getting the following error. Any help appreciated. -m. $cat app/views/admin/new.rhtml <% @page_title = "New member..." -%> <%= start_form_tag( :action => ''create'' ) %> <table> <tr> <td> First Name: </td> <td> <%= text_field(
2006 Jan 10
7
All My Rails Apps Died Over the Holidays
I have several Rails (version 1.0) apps I''m working on on a Win XP box using Webrick that were working fine before I left for the holidays. I came back, started up and they all get the same syntax and compile errors: compile error ./script/../config/../app/views/time/list.rhtml:4: Invalid char `\212'' in expression repeated over and over. Refreshing the page gives thes same
2006 Sep 11
2
Compilation Errors
Hey there, I just updated to ferret 10.0.4, and acts_as_ferret 0.3, and now when I try to run my app with mongrel on Windows, I get very strange compile errors: ompile error C:/rails/app/script/../config/../app/views/login/index.rhtml:8: Invalid char `\002'' in expression C:/rails/app/script/../config/../app/views/login/index.rhtml:9: syntax error _erbout.concat "
2006 Jan 26
42
ruby script/generate scaffold Product Admin hangs
Hi I am running Mac OX tiger with the installed ruby 1.8.2, and mysql5 (I checked that it was running in preference). I tried to run the various fixes recommended in agileweb. I am stuck on page 57, script/generate scaffold... > Could you paste in your database.yml file, from the > "config" folder inside your Rails app? If you have any > passwords entered there, you should
2006 Jan 19
9
start_form_tag not taking url_for options
I''ve got a form that should post to user/login. The code to start the tag is: <%= start_form_tag { :controller => "user", :action => "login" } %> That gives me this exception: compile error script/../config/../app/views/user/login.rhtml:1: parse error, unexpected tASSOC, expecting ''}'' _erbout = ''''; _erbout.concat((
2007 May 28
2
helper with block compile error
HI, i''m trying to write a helper that replaces link_to_remote that accepts a block but it gets a compile error in the template: I don''t know what I''m doing wrong... TIA # application_helper.rb def link_block_to_remote( options = {}, html_options = {}, &block) concat(link_to_remote(capture(&block), options, html_options), block.binding) end # in
2006 Apr 08
5
Strange error ...
I''m getting a very strange error in a very vanilla Rails app setup: compile error ./script/../config/../app/views/home/index.rhtml:1: parse error, unexpected $, expecting kEND _erbout = ''''; _erbout.concat " <div id=\"index_main\">\n" ... ? Anyone know what this might be? I installed the Login Engine and the error started. I''m using