Не совсем уверен, где я делаю неправильно, я следую this post о том, как настроить драгоценный камень Lob с помощью Ruby.Rails undefined method/can not retrieve methods from a gem
В настоящее время мой контроллер выглядит следующим образом
class UsersController < ApplicationController
require 'lob'
def index
....
end
def create
....
end
def show
@user = User.find(params[:id])
@result = User.return_representative(@user.address)
....
Lob.api_key = 'test_my_api_key'
@lob = Lob.load
@lob.letters.create(
....
)
end
private
....
end
Однако я получаю сообщение об ошибке неопределенный метод `буквы. Я неправильно настраиваю вызов, или я делаю что-то еще совершенно неправильно? Из сообщения, связанного выше, это, как представляется, способ создания драгоценного камня.
Edit: Бег @lob.methods
Я получаю следующее
[: опции,: опции =,: участки,: адрес,: bank_accounts,: чеки, : стран,: рабочие места,: объекты,: тара ,: открытки,: маршруты, : службы,: settings,: states,: base_url,: construct_url, : format_address_params,: blank ?,: present ?,: presence,: psych_to_yaml, : to_yaml: to_yaml_properties,: act_like ?,: duplicable ?,: deep_dup, : себя,: try,: try !,: in ?,: presence_in,: to_param,: to_query, : instance_values,: instance_variable_names, : to_json_with_active_support_encoder, : to_json_without_active_support_encoder,: to_json,: as_json, : with_options,: html_safe ?,: `,: require_or_load,: require_dependency, : load_dependency,: выгрузить без,: ноль ?,: ===: = ~ ,:! ~,: eql ?,: hash, : < =>,: class,: singleton_class,: clone,: dup,: taint,: tainted ?, : untaint,: untrust,: untrusted ?,: trust ,: замораживание,: замороженное ?,: to_s, : проверить,: методы,: singleton_methods,: protected_methods, : private_methods, public_methods:,: instance_variables, : instance_variable_get,: instance_variable_set, : instance_variable_defined ?,: remove_instance_variable,: instance_of ?, : kind_of ?,: is_a ?,: tap,: Отправить,: public_send,: reply_to ?,: expand, : display,: method,: public_method,: singleton_method, : define_singleton_method,: object_id,: to_enum,: enum_for,: gem, : class_eval,: silence_warnings,: enable_warnings ,: with_warnings, : silence_stderr,: silence_stream,: suppress,: capture,: silence, : спокойно,: byebug,: debugger,: concern,: suppress_warnings,: ==, : equal ?,:!,:! =,: instance_eval,: instance_exec,: отправить,: идентификатор]
Кажется, как будто письма является не доступный метод. Означает ли это, что документация неверна?
Вы не смогли добавить к себе вопрос @ lob.methods? –
@SachinSingh Я добавил результат '@ lob.methods'.Кажется, что письма не доступны. Означает ли это, что документация неверна? – user3277633
У вас есть адрес и письмо? –