ruby on rails 4 - Why do these models and methods crash my server/stack level too deep? -


I am new to Ruby-on-Rail and it is slowly trying to understand how everything works But I have taken part in this, a brick wall at this point.

I have models

  class users & lt; ActiveRecord :: Base Valid: Username, {: uniqueness = & gt; True: Attendance = & gt; True} validates_presence_of: password_digest ,: on = & gt; : Making has_one: player, dependent: deleted has_secure_password has_many: through planet, :: player end class player & lt; ActiveRecord :: Base has has_many: Planet, Dependent :: deleted is_to: User validates_presence_of: race, on: create end squared planet & lt; ActiveRecord :: Base is_to: player end  

In my UserController I create a user with login and password and it works just fine then I redirect to my player controller where I have There is a simple radio button to select the race (just one now) and then make the player and add it to the current user. This also works fine too. Now the problem is that when I try to add the player to the planet. I do this in the same controlling method (not sure it's fair, but it needs to be populated with a new planet with a default planet).

  DRF Generation_Author {class: 'homeworld', land: 500, ore: 100, agriculture: 0, industry: 0, housing: 10} make end DRF @ current_user. Player = Player.New (player_perm) @turn_user.player.plnet.state_datas_read_digit_to_activation: home end  

generate current_user.player.planets.create- my server is completely Exchanges accidents from before before when both of them were removed: player from player and related_to: player from planet: I get stack level very exception.

Obviously, there is something that I am doing very wrong but I do not know it is. I tried to debug, but once I went to a certain point within the railway source code my debugger would be disconnected and I would have to force the server to stop.

Any insights will be greatly appreciated. Depending on your gener_attributes method, it seems that you have

class on your planet model is almost certainly causing your problems, and you need to use a different name from class .

The reason for this is that in Ruby, there is just one class about everything, such as:

  & gt; & Gt; "Foo". Class # = & gt; String & gt; & Gt; User.first.class # = & gt; User  

However, for your planet model, class is being set on string to handle rail organizations Uses a lot introspection in the names of; Because you are connecting this planet with the player to related_to , I'm assuming that the railway examines the orbit of the planet is the purpose of ensuring that it is correct, it is expected to be like "HomeWorld" instead of planet , and as a result Exception increase

(And even to remove organizations from photos, you will still run into problems using the class as a code name.)


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -