This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class XController < ApplicationController | |
before_filter :except => [:show, :..] do |c| c.check({".." => "administrator"}) | |
end | |
# ... various methods ... | |
end | |
def check(x) | |
...... | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PinController | |
def fees | |
@title = "Pay Fees" | |
if request.post? | |
pin = Pin.check_pin_value(params[:pin][:number]) | |
if pin.nil? | |
flash.now[:error] = "Unable to Pay Fees,Check You Pin and Make sure it has not been Used" | |
else | |
# pin_value = pin.pin_value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have this in my Model | |
validates_attachment_size :pic, :less_than=>15.kilobyte, | |
:if => Proc.new { |imports| !imports.pic_file_name.blank? | |
which should presumably rejects uploards larger than 15 Kb, but i can upload files larger than 15KB, it shows no errors |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
validates_attachment_size :pic, :less_than=>1.kilobyte, | |
:if => Proc.new { |imports| !imports.pic_file_name.blank? } | |
validates_attachment_presence :pic | |
validates_attachment_size :pic, :less_than => 5.megabytes | |
validates_attachment_content_type :pic, :content_type => ['image/jpeg', 'image/png'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have this issue, i'm new to rails. This is a custom authentication code, but when i enter a email address contained in my database, i get "Invalid Email/password Combination", | |
If i enter a valid email address but leave the password field blank, the user is loged in,What am i doing wrong please? | |
User.rb | |
def has_password?(submitted_password) | |
encrypted_password == encrypt(submitted_password) | |
end | |
class << self |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this works, details are updated accordingly | |
def fees | |
@pin = Pin.new | |
@title = "Pay Fees" | |
if request.post? | |
pin = Pin.check_pin_value(params[:pin][:number]) | |
user = User.find(current_user.id) | |
amount = params[:pin][:value] | |
if pin.nil? | |
flash.now[:error] = "Unable to Pay Fees,Check You Pin and Make sure it has not been Used" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.cache_classes = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.cache_classes = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls -l {file_name} #from within your Terminal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#course_helper | |
def coursenames(courseid) | |
@coursedept = Department.all(:include => :courses, :conditions => ["courses.id = ?",courseid]) | |
for i in @coursedept | |
return i.name #return the department's name | |
end | |
end | |
OlderNewer