similar to: if and else

Displaying 20 results from an estimated 30000 matches similar to: "if and else"

2006 Jul 26
2
sessions
hi! im implementing a login system for a messageboard. tooked from a book. pretty simple. everythings works great, but in the example the idea is, when i want to create a new message, the author name shall be tooked from the session[:user] def create params[:message][:date] = Time.now params[:message][:author_id] = @session[:user].id #here!! @message =
2006 Jul 26
2
How do you stop a ruby method prematurely
Hey guys, I was wondering how to stop a method without having to perform an action or redirect? I tried using "stop" or "exit" but they didnt work -- Posted via http://www.ruby-forum.com/.
2006 Jul 25
11
Prevent users from entering urls
How could I make it so that links on my page could link to a controllers action, but if the user manually entered the url, it would redirect them back to the main page? Is this possible? Thank you, -Ben Lisbakken -- Posted via http://www.ruby-forum.com/.
2006 Jul 26
2
There is Something wrong with the div...
<div id="cart"> <% if @cart.items.empty? %> style="display: none" <% end %> <%= hidden_div_if(@cart.items.empty?, :id => "cart") %> i dont know how to fix it, iv looked all over the book ruby on rails and cant ever find whats wrong with it... -- Posted via http://www.ruby-forum.com/.
2006 Jan 18
22
Creating multiple child objects from the same form
I''ve been digging into rails, but this one question has been a two day stumper. I''ve got a question/answer model that I''m trying to work out. Each question has multiple answers (they''re more like choices, it doesn''t matter whether they''re right or wrong), and I''d like to have the question creation form also have multiple fields in
2006 Jul 23
6
routes
My best guess at how to make this route map.connect '':user'', :controller => ''user'', :action => ''profile'' makes my link_to :controller => ''admin'', :action => ''index'' stop working ? I''m needing urls like http://localhost:3000/username but without breaking all my other controller index
2006 Jun 28
6
Rails 1.1.3 and routes to controllers in directories
Hi, All my controllers in subdirectories aren''t reachable by the normal urls anymore since my upgrade to 1.1.3. 404 errors. Did anybody else experience this? grtz Thijs -- Posted via http://www.ruby-forum.com/.
2006 Jul 25
3
Controller namespace problem?
I''m not getting any love grouping controllers into separate namespaces and I''m hoping someone can tell me what I''m not getting: $ rails foo $ cd foo $ script/generate controller Namespace::Bar index $ script/server $ lynx http://localhost:3000/namespace/bar -> 404 -> Routing Error -> Recognition failed for "/namespace/bar" Many thanks in advance.
2006 Jul 25
2
What to use in params[:name]
I am using the auto complete components in Rails, and if I look at the generated source I see that the id is model_field and the name is model[field]. Given that i am evaluatin params individually , and not part of one form variable, which should I use to call that value with params[:name], model_field or model[field]? Thanks for your help and time, Ben -- Posted via
2006 Jul 26
1
How to create table entry with multiple related categories?
Perhaps I should create a table row to hold an array of category ID''s? There''s probably an easy standard way of doing this in RoR and I just can''t wrap my brain around a practical way to do this right off. Specifically... I have a table that contains my product category names and another table that contains my actual product names with other product specific
2006 Jan 30
9
Something as after_successful_validation?
I need to call callback only if the validation was successful, but it seems it is called also when validation fails. -- Posted via http://www.ruby-forum.com/.
2006 Jan 17
6
An object that initializes multiple objects?
Hi, Something that I have noticed is that every class that inherits from ActiveRecord::Base has a database table of its own. However what if I don''t want a class to have its own table, but to actually serve as a proxy to initialize other entries? For instance as an example, let''s have a form with the fields for "student name", "student id number",
2006 Jul 25
4
Problem installing plugins
I''m trying to install a plugin using the supplied command... $ script/plugin install svn://rubyforge.org//var/svn/backgroundrb I get an error sh: line 1: svn: command not found What am I doing wrong? What is svn, and why is it not found?? It seems to work for everyone else.... Have I missed something in my Ruby install? -- Posted via http://www.ruby-forum.com/.
2006 Jul 28
6
need recommendations for apache configurations
I''m running a rails app on FedoraCore4 and so far have been using lighttpd and fastcgi. I''ve decided to switch to apache because lighttpd has been far too unstable, unpredictable, and slow. I don''t know if it''s lighttpd or the combination of lighttpd and fastcgi but it''s just not working for me. I need something that has been proven to work and
2006 Jul 26
6
mongrel_cluster
I''m currently working on 4 different RoR apps all using mongrel cluster and each with their own config file in /etc/mongrel_cluster. I would like the ability to stop|start|restart a single app. Anyone working on something like this? I''d be happy to code it up and contribute this if there''s a need. Basically I would like this: sudo /etc/init.d/mongrel_cluster restart
2007 Mar 29
1
Wikibooks
As a big fan of Wikipedia, it's frustrating to see how little there is about R in the correlated project, the Wikibooks: http://en.wikibooks.org/wiki/R_Programming Alberto Monteiro
2006 Jan 17
3
Models, Modules, and Callbacks
There''s been some discussion about this before but I think I have a unique problem. I am trying to use modules with models to avoid naming conflicts while connecting to more than one database. Everything seems to be working ok in that we have: - Model definitions in models/namespace/model.rb - Controllers accessing models by Namespace::Model - Controllers loading models using ? model
2006 Jun 29
13
Ideal Ruby on Rails Development Environment on Linux
Hello, I''m not a developer myself, but I work for a hosting company that tries to cater to the needs of developers and basically right now I am trying to create a hosting platform that will be perfect for ruby developers. This is a linux VPS service and I create the base templates to make the system look however i want it after install. I was hoping some of you could give me
2006 May 12
11
Stupid? question about if else logic
this seems so stupid, I keep thinking I''ve dealt with this before but I have this code <h1>Portraits</h1> <% if @image.portrait == 1 %> <%= image_tag(url_for_file_column ''image'', ''file'', ''thumb'') %> <% else %> <h1>Landscapes</h1> <%= image_tag(url_for_file_column
2006 Apr 18
2
ruby on rails and Micro$oft environment support - IIS & ms sql
Hi everybody At work we''ve finally convinced the chief to develop some small project using open source technology. Unfortunately we are deeply involved with Micro$oft technology. That means, windows 2003 server, IIS, MS SQL 2005 and asp. I was thinking about recommending ruby on rails instead of asp, but I''d like to know how well it goes with IIS and MS SQL, because for the