README.mdown in intercom-rails-0.2.4 vs README.mdown in intercom-rails-0.2.5
- old
+ new
@@ -37,11 +37,11 @@
* You've generated a config file with your `app_id` as detailed above.
* Your user object responds to an `id` or `email` method.
* Your current user is accessible in your controllers as `current_user` or `@user`, if not in `config/initializers/intercom.rb`:
```ruby
- config.current_user = Proc.new { current_user_object }
+ config.user.current = Proc.new { current_user_object }
```
Feel free to mail us: team@intercom.io, if you're still having trouble.
## Configuration
@@ -62,11 +62,11 @@
* Or, a method which will be sent to the current user object
to generate the values of the custom data:
```ruby
- config.custom_data = {
+ config.user.custom_data = {
:plan => Proc.new { |user| user.plan.name },
:is_paid => Proc.new { |user| user.plan.present? },
:email_verified => :email_verified?
}
```
@@ -74,16 +74,16 @@
In some situations you'll want to set some custom data specific to a request. You can do this using the `intercom_custom_data` helper available in your controllers:
```ruby
class AppsController < ActionController::Base
def activate
- intercom_custom_data[:app_activated_at] = Time.now
+ intercom_custom_data.user[:app_activated_at] = Time.now
...
end
def destroy
- intercom_custom_data[:app_deleted_at] = Time.now
+ intercom_custom_data.user[:app_deleted_at] = Time.now
...
end
end
```
@@ -121,15 +121,15 @@
This will behave exactly the same as the default auto-install. If for whatever reason you can't use auto-install, you can also provide a hash of user data as the first argument:
```erb
<% if logged_in? %>
<%= intercom_script_tag({
- :app_id => 'your-app-id'
- :user_id => current_user.id
- :email => current_user.email
- :name => current_user.name
- :created_at => current_user.created_at
+ :app_id => 'your-app-id',
+ :user_id => current_user.id,
+ :email => current_user.email,
+ :name => current_user.name,
+ :created_at => current_user.created_at,
:custom_data => {
'plan' => current_user.plan.name
}
}) %>
<% end %>
@@ -138,16 +138,16 @@
You can also override `IntercomRails::Config` options such as your `api_secret`, or widget configuration with a second hash:
```erb
<% if logged_in? %>
<%= intercom_script_tag({
- :app_id => 'your-app-id'
- :user_id => current_user.id
- :email => current_user.email
- :name => current_user.name
+ :app_id => 'your-app-id',
+ :user_id => current_user.id,
+ :email => current_user.email,
+ :name => current_user.name,
:created_at => current_user.created_at
}, {
- :secret => 'your-apps-secret',
+ :secret => 'your-apps-api-secret',
:widget => {:activator => '#Intercom'}
}) %>
<% end %>
```