Page 1 of 1
[20:35:02] Aque0s: good evening everyone. How can I create a custom route helper? I have an STI setup with a base model named Content... I've then got a bunch of content types and I'd like to create a route helper like content_path(@content) which returns the URL for that piece of content dependant on its type...
[22:12:25] Aque0s: Hello. If I have a comment that belongs to a parent model, where is the best place to set that association when creating a new comment?
[22:15:08] Aque0s: davidcelis: okay hmm, so at the moment, a comment belongs_to :poem. On my poems#show page, I want a new comment form.
[22:15:37] Aque0s: davidcelis: In the poems#show action, should I be creating a new instance of a comment to pass to form_for in the show template?
[22:19:18] Aque0s: davidcelis: okay, so I've got @comments = @poem.comments; @new_comment = @poem.comments.build; and then I loop through @comments in my template, and then have form_for @new_comment at the bottom. However I'm getting an error and it looks like it's trying to iterate over this new comment and display it...
[22:19:57] Aque0s: brice_: I'm working on my first rails app atm, just decide on something to build and read the docs!
[22:22:55] Aque0s: brice_: put together a roadmap of features you'd like to implement and then come ask for help about the best approach for implementing each feature AFTER you've done sufficient searching yourself
[22:24:15] Aque0s: davidcelis: I don't like the idea of building the new comment object in the template... Does comments.build modify the original collection? How does one not cause @poem.comments to be modified?
[22:24:44] Aque0s: brice_: nope, I come from PHP... Yii mostly. Good luck on your coding adventures man.
[22:29:15] Aque0s: davidcelis: hmm, setting the poem for the new comment doesn't seem to work because the comment object is just recreated in comments#create with the params from the form... where do I set the association? what is the generally accepted method?
[22:30:18] Aque0s: but I'll have to do it in comments#create... so how do I gain access to the @poem?
[09:01:24] Aque0s: Hello gentlemen, in my new session view, I'd like to determine whether it was the email address or the password that was incorrect. What is the best way to do this? I'm using Devise.
[09:02:26] Aque0s: sevenseacat: I know and have raised that with my manager, but he adamant that it should show you whether the email address is in te system or not
[09:05:31] Aque0s: samuel02: I was hoping to just use the find_by_email method on the user model to determine whether the address is in the DB or not, but I'm not sure where to make that call.
[09:06:01] Aque0s: sevenseacat: that's what I thought. Where would I do that? In the sessionscontroller? Not sure which action though.
[09:07:01] Aque0s: sevenseacat: so all I need to do is set up an instance variable indicating whether it was the email/password that was incorrect? I'm very new to Rails.
[09:09:15] Aque0s: samuel02: would making a call to find_by_email within session#create not work? I could just set an instance variable which would be passed through to the view and let me display the correct message... I think.
[09:44:02] Aque0s: in my devise session#create controller, how do I pass an instance variable to the view?
[09:48:41] Aque0s: m4rtijn: I've tried @email_valid = :no unless User.find_by_email(params["user"]["email"]) - but alas it does not work :(
[09:56:59] Aque0s: m4rtijn: I see, by that do you mean the controller in which the view is rendered?
[09:59:06] Aque0s: m4rtijn: I'm trying to determine whether it was the email address or the password which is invalid
[15:07:38] Aque0s: Hi everyone, I'm experiencing a headache provoking issue... in this scenario, a user belongs to many groups, in the sense that they are members of that group (belongs_to_and_has_many relation), however a user can also own many groups (has_many relation)... I'm not sure how to avoid the naming conflict