Activity Graph

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...
[20:36:36] Aque0s: okay, so in application_helper.rb?
[20:37:00] Aque0s: I would yes
[20:37:52] Aque0s: I see, okay... Is there an accepted approach for STI routing?


[09:31:28] Aque0s: Hello, does anyone here have experience with apotomo?


[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:15:44] Aque0s: davidcelis: btw, thanks for the help!
[22:19:18] Aque0s: davidcelis: okay, so I've got @comments = @poem.comments; @new_comment =; 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:20:44] Aque0s: brice_: a social-esque website for a literary magazine
[22:21:32] Aque0s: from where brice_ ?
[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:23:09] Aque0s: brice_: I'm learning at the moment lol!
[22:24:15] Aque0s: davidcelis: I don't like the idea of building the new comment object in the template... Does 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?
[22:30:36] Aque0s: oh, I'm posting to comments#create (/comments)...
[22:31:09] Aque0s: I see so!
[22:31:14] Aque0s: so how do I make the form post to the poem_id route
[22:32:17] Aque0s: :/ no idea how to do that


[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:04:41] Aque0s: sevenseacat: any ideas?
[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:13:15] Aque0s: samuel02: sevenseacat left :(
[09:14:33] Aque0s: m4rtijn: you could just cast it as an integer if that's what you're looking todo
[09:14:36] Aque0s: otherwise regex?
[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:50:45] Aque0s: m4rtijn: the instance var is set correctly, but isn't passed to the view
[09:53:59] Aque0s: m4rtijn:
[09:55:33] Aque0s: m4rtijn: well, i think respond_with is what renders the view
[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
[10:02:44] Aque0s: m4rtijn: I agree, stupid functional spec :(
[10:10:09] Aque0s: solidus-lake: I hear you, will reconsider with team.
[10:15:34] Aque0s: solidus-lake: fuel gratefully accepted.
[10:15:50] Aque0s: solidus-lake: fuel gratefully accepted.


[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