similar to: easy question

Displaying 20 results from an estimated 30000 matches similar to: "easy question"

2006 Jul 17
10
getting the user name
Hi I am new to ruby and trying to obtain the user name in the login index.rhtml where I could display "You have logged in [user name]" How could I do this? I have been trying different options after reading the ruby manual but still throw an error. please help -- Posted via http://www.ruby-forum.com/.
2006 Aug 08
8
Generating a unique id ?
Hello, I need to generate a unique ID, so far I''ve unit tested this under 100000 iterations and it seems to work : now.to_i.to_s + ''-'' + now.usec.to_s + ''-'' + rand(1000).to_s Is there a better way ? Thanks Notes : 1) without usec, few percents of generated values are not uniques 2) the id generated is a string so the presence of
2008 Jul 09
2
setting request.raw_post with rspec-rails
... is there a way to do this? We have some REST-ish POSTs we''d like to spec out. In the controller this gets accessed with request.raw_post.to_s, is there a way to set this with rspec? Thanks as always, Francis
2006 Apr 24
3
TimeStamp conversion
Hi, I''ve got a TimeStamp field in MySql and want to use the hour and minutes in the value. for example: StartTime = Schedule.find(action2.ScheduleID).DateTimeStart.to_s That returns "Mon Feb 20 08:00:00 Romance Standard Time 2006" How do I get 08:00 returned ?? Thanks ! Steven. -- Posted via http://www.ruby-forum.com/.
2006 Feb 14
2
confusion with validates_inclusion_of
It appears that if your trying to use validates_inclusion_of for a string value allow_nil wont work. For example, if I have an attribute :year which is stored as a varchar then: validates_inclusion_of :year, :in => "1980"..Time.now.year.to_s, allow_nil=>true will successfully validate the range but will not allow an empty input field to be submitted. However, if :year is
2006 Jan 20
13
Calendar date picker for use with rails.
Howdy folks, As I was putting together a rough form for a rails app, I got to thinking how much smoother (in my siytuation) a little calendar widget would be than the default date picker selects. Does anyone know if such a thing exists ? I suspect it would have to be somewhat designed with rails in mind to populate the right kind of post params for convenient use at the controller end.
2006 Apr 06
10
Advice needed on tracking down unusual error
Does anyone have advice on how to go about locating the cause of this error message: ActionView::TemplateError (wrong number of arguments (3 for 1)) on line #4 of app/views/products/search.rhtml: 4: <%= start_form_tag :action => ''search'' %> I don''t see anything wrong with line 4 above. Some background: I''ve made a number of changes to Controllers,
2006 Jun 13
5
strange RJS behavior
I used RJS extensively in my last web app with no problem. I''m just beginning a new one and having a very odd problem. The called method, get_names, retrieves some values from the database, then ends: render :layout => false the get_names.rjs file is rendered into Javascript, but then is just dumped as Javascript (text) into the browser: e.g: try {
2006 Feb 06
6
ActionMailer - ROR Recipes - Multipart/alternative
I am using the SaltedHashLoginGenerator. and would like to send the e-mail in multipart/alternative format. By default my application is using forgot_password_en.rhtml template. I read in the ROR Recipes book "ActionMailer sees these templates, recognizes the pattern in their file names, and automatically sets the MIME type of the message to multipart/alternative and adds
2006 Mar 14
5
Maddening library loading problem
Hi everyone. I recently wrote a nice module that I want to use in my rails app. It consists of a few files in a directory that I have places in the lib directory. It looks like this: /lib/KMLTools/foo.rb, bar.rb, baz.rb Some of these files load each other and I finally got those to work by using the File.dirname(__FILE__) trick. When I simply require the file into my controller, everything is
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 Apr 26
3
drop downs
I''m having trouble getting a second drop down populated based on the value from the first drop down. I''ve tried following some of the examples posted, but haven''t had any success. I''m new to RoR so any help would be appreciated. When the first drop down''s value gets changed, it calls the correct method in the controller and even finds the correct
2006 Mar 13
9
apache 1 fastcgi config correct???
I followed this tutorial on the rails wiki about how to get apache with fastcgi working on a vps machine: http://wiki.rubyonrails.com/rails/pages/HowtoInstallAndRunRubyOnRailsOnCpanel In the tutorial it said to add this to the httpd.conf file to get fastcgi working. <IfModule mod_fastcgi.c> FastCgiIpcDir /tmp/fcgi_ipc/ AddHandler fastcgi-script .fcgi </IfModule> However
2006 Mar 24
3
1.1RC and Lighttpd
I started what I thought was going to be a 30 minute project on the train this morning to write a little timetracker for myself. Amongst other things (don''t have a model called Task as it conflicts with Rake at the moment, don''t have a model called Action as it disappears in the hash when you submit a form :-), I had to use Webrick as Lighty complained about an unknown
2006 Apr 03
5
Strange Problem with ActionController (I think)
I''m working through the Agile Depot example I have no idea what I did, but when I try and delete something from the web page I get this error on the log. Processing AdminController#destroy (for 127.0.0.1 at 2006-04-02 22:28:06) [GET] Session ID: 4371bd7ca2cb5ec5e08e60a7590df90a Parameters: {"action"=>"destroy", "id"=>"5",
2006 Jun 16
3
Routing Error - Recognition failed for..
I followed the guide for RailsOnWindows (http://wiki.rubyonrails.org/rails/pages/RailsOnWindows) and completed all the steps without any problems. But when I try to access my page, I get: Routing Error Recognition failed for "/rails" rails is what I have in my httpd.conf: <VirtualHost *:80> ServerName rails DocumentRoot "D:/devapps/Apache
2006 Feb 14
6
routes question [Catching URL in a variable]
Hello Rails Gurus, I have spent the entire night trying to figure this out with no luck. I will really appreciate if someone can come to my rescue. I have a URL like the following: http://domain.com/resource/http://www.rubyonrails.org and would like to capture the rubyonrails URL after the http://domain.com/resource/ part in a variable. I tried something like
2006 Apr 05
6
How to Upload Image through RoR??
Hi, I have one form , in which I am using file_field teg for input image file as follows. ===== <%= file_field("store", "picture") %> ======= Tha Actual fileld name of my Image field in Database is "store_photo" with datatype LargeBLOB. & Inside my Store Model I have specified "def picture" as follows:- ========================= def
2006 Jun 06
4
Troubleshooting "Lost connection to MySQL server.."
Hello all, Though I''ve read all I could about the "Lost connection to MySQL server during query: SHOW FIELDS FROM ...", I''m still unable to use RoR. I''m on Linux Mandriva 2006 / MySQL-4.1.12 / ruby-1.8.2 - The userid/password have access to the database and the table (it''s the root user on MySQL) - I''m on a nonstandard socket/port, but
2006 Apr 03
18
newbie generate scaffold
Hi Guys First time on the list and pretty new to the rails way of doing things, yup I know sorry.. another newbie! anyway, apologies out of the way, this is the problem I am having... I have purchased the "Agile Development with Rails" book and have just started running through the ''Depot'' demo application. I have got to page 57... I have my project files all