With regard to button_to, on first (and quick) inspection, I see that you 
are missing your first argument, name.  

Your button_to:

<%= button_to blockrelationships_path, class: 'btn btn-default btn-xs',
                        params: { 
                            blocker_callsign: @callsign, 
                            blocked_callsign: blockedcallsign
                        },
                        remote: true do %>
<% end %>

I usually get an error message like this when I am missing arguments in 
button_to.

The button_to prototype in Rails 4 is: 
(http://apidock.com/rails/ActionView/Helpers/UrlHelper/button_to)
button_to(name = nil, options = nil, html_options = nil, &block) 

name is what appears on the button, usually string like "Delete", "New", 
etc. 

Next, I am assuming that blockrelationships_path is your url path, 
controller/action/(:id)... something defined in your router?

I see that you are using a block in 'do'? Doesn't seem that you need it.  
Do you have content for the block?

I would try first to rewrite your button_to as: (Not sure about brackets 
surrounding your params)

<%= button_to ("Button Face Name String", blockrelationships_path, { class: 
'btn btn-default btn-xs',
                        params: { 
                            blocker_callsign: @callsign, 
                            blocked_callsign: blockedcallsign
                        },  remote: true } ) %>

If you need the block then I would try rewrite: 

<%= button_to ["Button Face Name String", blockrelationships_path, { class: 
'btn btn-default btn-xs',
                        params: { 
                            blocker_callsign: @callsign, 
                            blocked_callsign: blockedcallsign
                        },  remote: true }] do %>

<% end %>

I do not offer this latter suggestion confidentially as I could find very 
little on-line documentation regarding the use/syntax for button_to with a 
block. 

I am also concerned by:
<%= render partial: 'shared/block', locals: { blockedcallsign: 
post.callsign } %>  ...  It is apparent how you are using blockedcallsign 
in your 'shared/block' partial, are you sure that post.callsign is valid 
always?  Then I see @callsign?   What is @callsign? Is it valid?  Is it 
related to post.callsign?  Not sure about Rails 4, but in params have two 
keys with the same name, yet different values.

Hope this helps... 

Liz 



On Saturday, June 27, 2015 at 3:57:23 PM UTC-4, Bazley wrote:
>
> In the view.html.erb:
>
> <%= render @posts %>
>
> In each _post.html.erb:
>
> <%= render partial: 'shared/block', locals: { blockedcallsign: post.
> callsign } %>
>
> In each _block.html.erb:
>
> <%= button_to blockrelationships_path, class: 'btn btn-default btn-xs',
>                         params: { 
>                             blocker_callsign: @callsign, 
>                             blocked_callsign: blockedcallsign
>                         },
>                         remote: true do %>
> <% end %>
>
> I get the error: `undefined local variable or method 'blockedcallsign'`. 
> What's wrong with the code?
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/ba4ab285-301e-4514-8094-495eee7c37e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to