I needed to do the same thing: transform a field in a JSON blob that was sent with an HTTP POST to a Rails 3 app. In my case I just wanted to include a hashed digest of a field, so in config/application.rb:
config.filter_parameters += [:password, lambda {|key, value|
if key.to_s == 'my_key'
value.replace(calculate_my_hash(value))
end
}]
Is there a convenient way to separate view and controller logic depending on the environment?
Thanks Ryan!! I appreciate your clear mindedness that you demonstrate in your screencasts.
Ryan, thank you for this episode. I would like to use CoffeeScript in Rails 3.0.7 app. How caan I use it?
I needed to do the same thing: transform a field in a JSON blob that was sent with an HTTP POST to a Rails 3 app. In my case I just wanted to include a hashed digest of a field, so in config/application.rb:
config.filter_parameters += [:password, lambda {|key, value|
if key.to_s == 'my_key'
value.replace(calculate_my_hash(value))
end
}]
The users controller stores the user object in the session.
class UsersController < ApplicationController
def index
session[:user] = User.first
end
def show
@user = session[:user]
end
def update
@user = session[:user]
@user.first_name = 'Junk'
end
end
Thank you for this Railscast. Your work is slowly helping me understand the more interesting side of rails.
The documentation says that the :find keywords “may include the :conditions, :joins, :include, :offset, :limit, and :readonly options”.