Page 1 of 124 | Next »
[05:14:48] rvanlieshout: nadav: you mean a table with user_id:references article_id:references vote:something ?
[05:15:46] rvanlieshout: nadav: yeah sure. you might want to add a counter_cache if you expect a lot of votes
[05:16:43] rvanlieshout: nadav: to get the current vote status you'll have to query that table and sum (or whatever) vote
[05:17:15] rvanlieshout: that'll be fine if you add an index on article_id, but it might still be much if your articles are queried really often and you have a really big number of votes
[05:18:55] rvanlieshout: yeah. although iirc counter_cache only works for count, so you might need to create something yourself.
[05:19:53] rvanlieshout: nadav_: forget about it for now, after this is done read http://guides.rubyonrails.org/association_basics.html and seach for 'counter cache' in that guide
[05:20:19] rvanlieshout: and has a hidden id: http://guides.rubyonrails.org/association_basics.html#options-for-belongs-to-counter-cache
[06:26:56] rvanlieshout: noob_on_rails: you just commited all things, so there is nothing new to commit
[10:36:47] rvanlieshout: the method (note: function != method) is called after all before_filters (deprecated -> use before_action)
[10:38:07] rvanlieshout: user requests FooController#bar, gets redirected to sign in, signs in an wants to go back to FooController#bar ?
[10:40:17] rvanlieshout: nor should it. cause if you want that method to be executed, you don't want to redirect in a before_
[10:41:04] rvanlieshout: if you send the user to an authentication page you don't want that action to be performed
[10:44:26] rvanlieshout: then create an action where you redirect to after sign in. in that action redirect back to that saved url from the session
[11:02:16] rvanlieshout: show the actual sql and the created_at's of the two using select created_at from posts
[04:29:35] rvanlieshout: i'd rather have my app working on as many places as possible then having some less data in the url that hardly any visitor will notice
[10:58:22] rvanlieshout: http://api.rubyonrails.org/classes/AbstractController/Rendering.html#method-i-render_to_string
[10:59:10] rvanlieshout: the way you should use partials. if any of your partials contains any variable with @, it's wrong :)
[13:16:04] rvanlieshout: you don't link forms, you either set the subject_id in the controller or using a hidden input
[13:25:33] rvanlieshout: me too, those other syntax things are just there because it already has support for rails
[13:28:20] rvanlieshout: :) i just don't want to keep track of all dependencies related to different projects
[07:26:10] rvanlieshout: elomatreb: AimlessRaven has been here for a long time, but still refuses to follow any tutorial or read documentation
[07:26:47] rvanlieshout: and i agree with both Scient and dminuoso. A ternary operator would reduce half of that code, as AimlessRaven requested. Moving it to a helper or a decorator are also possibilities. Feel free to have opinions on if they are the right one
[10:02:04] rvanlieshout: AimlessRaven: just curious, why don't you feel any urge to invest some time to learn?
[11:15:44] rvanlieshout: and what's in app/extensions/controllers/app_base.rb:23:in `block (2 levels) in <module:AppBase>' ?
[11:21:59] rvanlieshout: alfiemax: all that are valid on your server, there is a rake (or rails (for version 5)) task for it
[11:23:11] rvanlieshout: also edit https://github.com/lautis/uglifier/blob/master/lib/uglifier.rb#L161 (use bundle show uglifier to get the path to that gem)
[10:00:46] rvanlieshout: in that case you'll just need a #decorate on any activerecord instance that tries to doe a UserDecorator.new(usser). you can delegate everything to the object in there
[10:02:29] rvanlieshout: the model shouldn't contain view-related stuff. it's going to be a new layer (app/decorators)
[10:03:13] rvanlieshout: nope. helpers are not instance related. you could create a helper, but that still feels ugly. then it would be something like <%= user_country(user) %>
[13:10:18] rvanlieshout: ok. that gem allows you to use acts_as_taggable or acts_as_taggable_on within your own models
[13:10:41] rvanlieshout: in order to process that, it expects certain database table(s) to exist, for that it has a rake task to createa a migration (rake acts_as_taggable_on_engine:install:migrations)
[13:11:51] rvanlieshout: https://github.com/mbleigh/acts-as-taggable-on/blob/master/lib/acts_as_taggable_on/tag.rb
[13:15:30] rvanlieshout: why would you want to edit it? it'll prevent you from easy updating this gem
[13:21:29] rvanlieshout: a controller should return the right (json-)response for some client-side action
[13:22:22] rvanlieshout: eva_: and know that a model doesn't (and shouldn't) know about stuff happening outside of that context