similar to: simple if - then question

Displaying 20 results from an estimated 10000 matches similar to: "simple if - then question"

2006 Jul 15
6
calendar_helper
Hi, anyone ever tried the calendar plugin? i can''t get it to work: i did: ruby script/plugin install http://topfunky.net/svn/plugins/calendar_helper ruby script/generate calendar_styles and then generated a controller calendar_controller with a method def monthly end in monthly.rhtml i put: <%=calendar(:year => 2005, :month => 6)%> if i try to run i get: undefined
2006 Jul 24
2
how to avoid repeating code in controller
Hi, I created a calendar class and i now have a method which gives me a 1 day view with timeslots etc. now i want to re-use that code for generating 2 and 5 day views. how can i re-use my code so i can make a show_two_days class which uses the logic of the show_one_day class? am i correct it can''t be done with helpers? regards, Remco -- Posted via http://www.ruby-forum.com/.
2008 Feb 15
3
Destroy, dependent and performance
Hi! This is my first post in this forum. I''m learning RoR for two weeks and I''m very interested about how to improve this framework. I was testing one app I''m working in and I had some problems with destroying. The code is simple (and maybe wrong, as I said i''m just learning!). When you destroy a league, you send a message to all the users associated to this
2006 May 31
1
code snippet
Hello people, found the following controller code and I wonder what it does and particulary the "and return" part. if @order == nil then redirect_to_checkout("blabla") and return end thanks -- Posted via http://www.ruby-forum.com/.
2006 Jul 27
17
How do you stop a Ruby method from executing?
Hey guys, How do you stop Ruby code from executing? For example, def newaction puts "1" return puts "2" end I tried return in the following example, but it continues and than looks for newaction.rhtml. How do I stop it completely dead in its tracks? -- Posted via http://www.ruby-forum.com/.
2005 Apr 27
2
Getting the name of an object as character
This could be really trivial, but I cannot find the right function to get the name of an object as a character. Assume we have a function like: getName <- function(obj) Now if we call the function like: getName(blabla) and 'blabla' is not a defined object, I want getName to return "blabla". In other word, if paste("blabla") returns "blabla" I
2006 Aug 02
5
Fun with ez_where
I''ve been trying to use the ez_where plugin to create a dynamic finder. The structure looks somehing like this.. === controller === def list attribute_filter = params[:filter] @filter = Caboose::EZ::Condition.new :table do attribute <=> attribute_filter if attribute_filter end # ... do the find with the @filter # end === view === .... <%= link_to
2006 Mar 14
21
Changing default date format in Rails
I''ve spent all day digging through the rails api and postgres-pr on this, I think it''s time to ask the list. Postgres stores a Date in YYYY-MM-DD format. My users want the dates in MM/DD/YYYY format. Sure, I could explicitly convert it on the app level every place where a date is displayed, but that seemed like a DRY violation. I thought I''d be clever and simply
2020 Jul 10
2
Way to start CDR when call is bridged ?
Hi, in dialplan -Asterisk 16.2 from Debian Buster- we have  same = n,Dial(PJSIP/101&PJSIP/102&PJSIP/103,15,tT) If thew call is not answered after 20 seconds, we launch a new dial with same and/or other extensions  same = n,Dial(PJSIP/101&PJSIP/104&PJSIP/110,20,tT) Looking in CDR we have at the end of the call (here we called 3 extensions which where ringing, let say 110
2012 Oct 02
1
[LLVMdev] Error prone default memory capturing convention of blocks.
Hi guys, I've been using blocks for a while and found that current behavior is error prone. So I am going to propose to you the better one. Motivation: 1) The __weak variables in blocks are very common pattern. So having any implicit default behavior makes thing worse. 2) Some stupid mistakes like: __weak typeof (self) theSelf = self; ...^ { theSelf.blabla = .. .... [self blabla];
2006 Jul 24
4
Destroy action doesn''t work?
Hi all, Here is my Customer controller''s destroy method: ** def destroy Customer.find(params[:id]).destroy redirect_to :action => ''list'' end It''s stock, untouched scaffold code. When I submit the URL: http://localhost:3000/customers/destroy/11 The entry in the MySQL database with id 11 is not destroyed. The destroy method won''t
2013 Jun 05
2
Template not putting in new lines.
hi all, Ive been having a bit of a trouble with something that should be pretty simple. My goal is to create a host file on a node with IP address and hostname (specified in the node manifest). I created the manifests and templates below but when I use them I get a hosts file without spaces or newlines, like below. Please help me figure out how do I add the spaces and new lines? Or where
2006 May 02
1
Only one NDS_ldapsam possible?
Hi, is there a way to define more than one NDS ldap server in smb.conf? It seems that only the first ldap server is used and if unavailable none of the other backends are going to be tried. Samba then still tries to connect over and over to the unavailable eDirectory-Server. My passdb entry looks like this (it?s all in one line): passdb backend = NDS_ldapsam:ldaps://serverA.blabla.com:636
2010 Mar 31
1
The exit code makes user confused while using '-' prefixed subcommands
guestfish returns 0 if the commands completed without error, or 1 if there was an error. But the rule break when we use '-' prefix subcommands: ------------------------------------ $ guestfish <<\EOF > blabla > EOF blabla: unknown command $ echo $? 1 $ guestfish <<\EOF -blabla EOF blabla: unknown command $ echo $? 0 ------------------------------------ I think it should
2006 Aug 01
3
Validation on ActiveRecord destruction
Rails has many built in validation methods to ensure that an ActiveRecord instance cannot be created or updated under certain situations (typically caused by invalid data). However, I can find no methods to govern whether an ActiveRecord instance can be destroyed. Essentially, I wish an error to be raised when a user tries to delete an ActiveRecord without first adhering to a certain set of
2006 Jul 17
2
european date format
hi, overhere users go nuts if they have to enter the date in iso format, so i have to make my applications in such a way that not only dates are displayed in the "dd-mm-yyy" format but also can be entered in that way. somewhere i found this code to put in the environment script: ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.update( :default => ''%d/%m/%Y
2010 Nov 17
2
Reference classes: accessor functions via 'getRefClass(...)$accessors(...)'
Hi there, I''d like to choose between an "static" and "dynamic" access of a reference class field, say ''a''. myObj <- getRefClass("Blabla")$new() Static: myObj$a Dynamic: myObj$a.get() where the function retrieves the data from a database (or some other location), stores it to a buffer and
2006 Jul 15
12
Safe way to destroy records
Hello, how can I check if a destroy was successful? Is the object only frozen if deleted or do I have to do an additional find to see if there is a record left? What happens if an after_destroy callback returns false? Is there always a rollback? Markus
2005 Aug 18
1
Creating directories before resource connect
When I have fileserver with many users homedirs (but all users from AD through winbind), how can I autocreate /usr/home/blabla, when I have just create user blabla in AD? Samba required existed directory to connect to resource, preexec= starts only after succesful connection. I'd like to automate process - when I have just create user blabla, when it connect first time to their homedir at
2006 Aug 10
2
Authentication: UserEngine or own creation?
Hi all I''m coding a project that needs a lot of authentication stuff... e.g. I write sort of a profile area, where users can create their different profiles. So I need to check if a user has the right to browse the profiles, if he has the right to change them all (as an admin) or the ones that belong to him etc. etc. This needs quite some logic... Now I wonder whether to use the