Syntax error, unexpected keyword_end, expecting end-of-input

3

I'm having a problem (It may be ridiculous but I do not know what to do). The following error is appearing:

SyntaxError in Group :: GroupsusersController # create /home/bruno/Documents/sites/mymoney/app/controllers/group/groupsusers_controller.rb:38: syntax error, unexpected keyword_end, expecting end-of-input

But so far I have not been able to figure out where the damn 'end' is.

Here are the codes:

    Class Groups::GroupsusersController < ApplicationController
        before_filter :require_authentication

        def create
            #goupsuser = group.groupsuser.find_or_initialize_by(user_id: current_user.id)
            #groupsuser.update!(groupsuser_params)
            #head :ok
            @groupsuser = Groupsuser.new(groupsuser_params)
            if @groupsuser.save
                flash[:notice] = 'User was successfully add.'
            else
                flash[:notice] = 'User cannot be add.'      
            end
        end

        def new
                    @groupsuser = Groupsuser.new
        end

        def update
            create
        end

        private

            def group
                @group ||= Group.find(params[:group_id])
            end

            def user
                @user ||= User.find(params[:user_id])
            end

            def groupsuser_params
                params.require(:groupsuser).permit(:user, :group)
            end

    end

The presenter:

    class GroupPresenter
        delegate :user, :name, :created_at, :to_param, to: :@group

        def self.model_name
            Group.model_name
        end

        def initialize(group, context)
            @group = group
            @context = context
            @groupsuser = groupsuser
        end

        def can_invite?
            @group.user == @context.current_user
        end

        def groupsuser
            @groupsuser = Groupsuser.new
        end

        def groupsuser_route
            [@group, groupsuser]    
        end

        def to_partial_path
            'group'
        end
    end

The form:

    <% if group.groupsuser.errors.any? %>
            <div id="error_explanation">
                <%= t 'general.form_error' %>
            </div>
    <% end %>

    <% if group.can_invite? %>  
        <%= form_for group.groupsuser_route do |f| %>
            <%= select("group.groupsuser", "user_id", User.all.collect {|u| [ u.full_name, u.id ] }, { include_blank: true }) %>
            <%= f.submit 'Add' %>
        <% end %>
    <% end %>

The model:

    class Groupsuser < ActiveRecord::Base
      belongs_to :user
      belongs_to :group

    end
    
asked by anonymous 30.01.2014 / 18:29

1 answer

4

The first word in your code is Class . I suppose it should just be class .

So you have an additional end in your code, which should be closing the class. just correct the capitalization.

    
30.01.2014 / 18:33