Re: [Rails] exiting the function

2010-04-27 Thread Andy Jeffries
> > > Mohammed, you can write the above as follows: > > @property.destroy if IsAuthorized?(@property.user_id) > > Well, you could, *if* IsAuthorized? -- which idiomatically should > be is_authorized? -- returned a boolean value :-) > Personally I'd prefer authorized? - I never use is_...?, the is_

Re: [Rails] exiting the function

2010-04-26 Thread Colin Law
On 26 April 2010 01:16, Mohammed Alenazi wrote: > Hi > > I have this code >  def destroy >   �...@property = Property.find(params[:id]) >   IsAuthorized?(@property.user_id) >   �...@property.destroy > >    respond_to do |format| >      format.html { redirect_to(properties_url) } >      format.xml

Re: [Rails] exiting the function

2010-04-25 Thread Hassan Schroeder
On Sun, Apr 25, 2010 at 5:20 PM, Conrad Taylor wrote: > Mohammed, you can write the above as follows: > @property.destroy if IsAuthorized?(@property.user_id) Well, you could, *if* IsAuthorized? -- which idiomatically should be is_authorized? -- returned a boolean value :-) >>  def IsAuthorized?

Re: [Rails] exiting the function

2010-04-25 Thread Conrad Taylor
On Sun, Apr 25, 2010 at 5:16 PM, Mohammed Alenazi wrote: > Hi > > I have this code > def destroy >@property = Property.find(params[:id]) > IsAuthorized?(@property.user_id) >@property.destroy > > Mohammed, you can write the above as follows: @property.destroy if IsAuthorized?(@property

[Rails] exiting the function

2010-04-25 Thread Mohammed Alenazi
Hi I have this code def destroy @property = Property.find(params[:id]) IsAuthorized?(@property.user_id) @property.destroy respond_to do |format| format.html { redirect_to(properties_url) } format.xml { head :ok } end end def IsAuthorized?(id) if current_