Heya,
I've been toying around a little more with rails and getting the hang of
it. Nonetheless the, most likely, easiest thing for you i can't achieve
somehow. I'm trying to add some comments to my post(complaint)(Same way
the starter tutorial does
it(http://guides.rubyonrails.org/getting_started.
Ah, got it. Thanks again, Colin! I used <%= at my each :) I'm so dumb xD
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
T
Heya,
Whenever i open my post page on localhost it shows the array of the
posts i'm getting out of my controller at the bottom of my yield.
I can't find any code where i'm stating that i want to see it there.
Any thoughts?
Thanks
--
Posted via http://www.ruby-forum.com/.
--
You received thi
Colin Law wrote in post #1065311:
> On 20 June 2012 09:32, Timen E. wrote:
>> card from my cardlevel array, but i can't seem to access it like this. I
>> can however loop it in a seperate each, but i don't want that obviously.
>
> You have not explained well
Still got one(Hopefuly last for now) question, guys.
I've got the above data now and i can access my cards through users that
are joined by the cardlevel. I'm trying to loop through all the cards a
user has as such:
<% @user.cards.each do |c| %>
<%= c.name %>
<% end %>
And this works great. H
Michael Pavling wrote in post #1065301:
> On 20 June 2012 08:51, Timen E. wrote:
>>
>> undefined method `user' for #
>> Extracted source (around line #3):
>
> @card is a collection of cards (that's how you populate it in the
> "show" action. If it
I've just got a really basic setup to see if i got it working:
card.rb
class Card < ActiveRecord::Base
attr_accessible :attack, :defense, :name
has_many :cardlevels
has_many :users, :through => :cardlevels
end
cardlevel.rb
class Cardlevel < ActiveRecord::Base
attr_accessible :card_id
Colin Law wrote in post #1065209:
> On 19 June 2012 13:38, Timen E. wrote:
>>
>> class Cardlevel < ActiveRecord::Base
>> belongs_to :users
>> belongs_to :cards
>
> Those should both be singular (:user and :card). Each cardlevel
> belongs to one u
I seem to have it up and running at this point. I made all the
has_many's etc. in my models. But when i try @cards.user (Or each it
first and use c.user) it says 'undefined method 'user''. So i'm assuming
i'm doing something awfully wrong.
My card_controller looks like this
def show
@cards
Thanks you guys, i've actually tried that(And failed) Perhaps you guys
can help me out.
I have to following files:
card_controller.rb
class CardController < ApplicationController
has_many :cardlevels
has_many :users, :through => :cardlevels
def show
@cards = Card.find(1)
end
end
--
Hey there,
Im fairly new to rails and i've tried several tutorials which taught me
how to use the associatives on a basic level(has_many => belongs_to).
However i'm trying to figure out how i can create and execute some kind
of a join. My case is:
I've got a list of playing cards in my DB that ar
Thanks alot,
in that case i'd like to ask the following question (since after some
tutorials it's still unclear to me)
I've got card_id = 1 and user_id = 1 in my DB now. In my user.rb i've
got the has_and_belongs_to_many:cards and in cards i've got
has_and_belongs_to_many:users. However, if i g
Hey there,
I was following up on some tutorials about has_many(_and_belongs_to).
There it was explain that i should make a join table as such:
create_table 'cards_users', :id => false do |t|
t.column 'card_id', :integer
t.column 'user_id', :integer
end
So i did, but now i wanna add a record
Hey there,
I just started R(oR) 2 days ago and still figuring out quite some stuff.
I kinda understand the scaffolding and associating between models.
However, as a next step i'm trying to make a category list and add some
posts under a pre-fab out of database category. I managed to save a post
w
14 matches
Mail list logo