Open Side Menu Go to the Top

07-09-2013 , 08:03 PM
That's funny. All it took was like 5 minutes of trying to handle both admins and non-admin rendering in the same controller to determine doing it like that is going to get painful really fast.

Seems like I'll go with different controllers for both the admin and front end side of things, different views rather than having a boat load of "if admin?" conditions and I'll use the same model.

Anyone have a better solution, or comments on the engine vs generator topic from my previous post?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
07-10-2013 , 12:07 AM
Quote:
Originally Posted by Shoe Lace
I'm about half way to my 3 week deadline with that rails project. So far I've read 3/4ths of eloquent ruby, watched 20 random railscasts videos and I don't think I'll miss the deadline.

Right now the only thing I'm unsure of is how I want to handle displaying the admin panel's contents. It seems using generators in rails is really popular but generators are just copy/pasting basically. I'm not sold on making an engine because an engine based admin panel doesn't seem to make sense.

It's also what turned me off from devise. It just adds so much unnecessary complication when you have controllers/views in the engine because you end up overwriting the views anyways. So now you have half the views in your /app folder and the untouched ones in your /gems folder outside of the project.

I might just try and make my own generators? What is the best way to do this? Also when it comes time to doing the front end, do you just use different layouts to handle outputting the same resource in 2 different ways based on the URL accessed?

Example:
In /dashboard/posts, you would likely lists posts in a table and it would be consumed by an admin.
In /blog, you would likely list posts in a typical blog style that is consumed by visitors.

In both cases they would use the same Post model and I guess the same controller?
I'm tired, but dashboard/posts and /blog/:id/posts you would be probably listing the posts under the parent object. So you'd do something like @posts = current_user.posts.limit(30) in dashboards or whatever you wanted to display in dashboards_controller, and in blogs_controller under the show view (or however you're doing it) probably do Blog.includes(osts).find(params[:id]).

And you'd render the views? So, different controllers. different views.

Off to bed.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2013 , 12:09 AM
Quote:
Originally Posted by Shoe Lace
That's funny. All it took was like 5 minutes of trying to handle both admins and non-admin rendering in the same controller to determine doing it like that is going to get painful really fast.

Seems like I'll go with different controllers for both the admin and front end side of things, different views rather than having a boat load of "if admin?" conditions and I'll use the same model.

Anyone have a better solution, or comments on the engine vs generator topic from my previous post?
creating gist on standard rails antipattern for you
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2013 , 05:24 AM
Quote:
Originally Posted by Nchabazam
creating gist on standard rails antipattern for you
Quote:
Originally Posted by Nchabazam
is this thing your showing him a pattern or antipattern?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2013 , 08:20 AM
Don't call me out on not knowing the difference
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2013 , 08:25 AM
Quote:
Originally Posted by Nchabazam
Don't call me out on not knowing the difference
lol, well one is bad and one is good (see, eg, "christ") i think you meant pattern since your gist seems like reasonable/good practice
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2013 , 08:44 AM
Yeah that looks pretty good. It's nice to see you can just define a controller-level layout like that. So if you had posts, comments, files and a bunch of other resources you would just copy/paste around the controllers/views for the admin side of things?

Last edited by Shoe Lace; 07-10-2013 at 08:50 AM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2013 , 08:53 AM
Quote:
Originally Posted by gaming_mouse
lol, well one is bad and one is good (see, eg, "christ") i think you meant pattern since your gist seems like reasonable/good practice
Pattern it is!

Quote:
Originally Posted by Shoe Lace
Yeah that looks pretty good. It's nice to see you can just define a controller-level layout like that. So if you had posts, comments, files and a bunch of other resources you would just copy/paste around the controllers/views for the admin side of things?
Yup. You'd put the admin controllers under app/controllers/admin/whatever_controller.rb

They'll often be slightly different, but you do get some duplication.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2013 , 10:00 AM
Yeah, I feel like it could be abstracted but it will add complexity that might not be worth it. I guess if it got too annoying then just make custom generators to spin up new resources?

I probably won't even look into that until the project is ready to be deployed, it would be something I would add afterwards.

I'm digging sorcery/cancan and kaminari was so easy to use it was almost too good to be true.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2013 , 10:13 AM
Cancan is pretty sweet. It was made by the railscasts guy, and he did an "authorization from scratch" series which basically showed how he went about writing it.

I decided to go along those lines and make my own authorization system for my last project, which worked quite well. Only problem I had with cancan is that it didn't seem to be super actively maintained.

Also, as you may have found, Devise is a nightmare. Just use has_secure_password with bcrypt, or some other gem. Once you try to customize devise, you're jumping through flaming hoops at every turn. Such a pain.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2013 , 11:50 PM
Pretty sweet last couple days of webbing for me. Yesterday I spend about 2 hours writing a jQuery slider with a bunch of animate to replace a flash banner.

Today I spend 3 hours fixing it so that IE8 (not IE10 in IE8 mode) will display the transparent PNG correctly. This is a company that doesn't support less than IE8 too. After trying a million things the eventual fix is to bring in ****ing belatedPNG.js! and also force IE7 mode with the meta tag.

Unbelievable that IE8 of all things can't handle transparencies 100% correctly. Good times.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2013 , 12:11 PM
Just came across this algorithm:

http://stackoverflow.com/questions/4...stt-in-c-sharp

I love clever elegant algorithms, this ones great. I don't know how useful it is for anyone else but just thought some of you might like it.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2013 , 12:21 PM
Quote:
Originally Posted by Gullanian
Just came across this algorithm:

http://stackoverflow.com/questions/4...stt-in-c-sharp

I love clever elegant algorithms, this ones great. I don't know how useful it is for anyone else but just thought some of you might like it.
Thats a nice one. Seems to be getting challenged though. Lets see if someone provides a proof its correct
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2013 , 01:15 PM
there is an outline of a proof in the comments. it's correct theoretically. someone made an interesting argument about how the practical limitations of a random number generator may come into play though.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2013 , 01:34 PM
That part was interesting. Any thoughts on how it would change for a situation where the order of the array is indeterminate? Is that answerable without knowing how the OS is ordering things? I'm think of a outlet collection of buttons in iOS.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2013 , 02:07 PM
Quote:
Originally Posted by kerowo
That part was interesting. Any thoughts on how it would change for a situation where the order of the array is indeterminate? Is that answerable without knowing how the OS is ordering things? I'm think of a outlet collection of buttons in iOS.
Shouldn't matter as long as you know the number of elements beforehand; if the original algorithm is picking k at random, the order can't matter.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2013 , 02:42 PM
Quote:
Originally Posted by github
Great repository names are short and memorable. Need inspiration? How about ballin-wight.
Now I want someone to draw that...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-12-2013 , 10:37 AM
Has anyone worked remotely for a long period of time?

I've done it for 3 years now and there are certain things that I'm finding more annoying than when I first started. Did you get burned out at it? Did you/Do you love it? General tips or complaints?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-12-2013 , 10:38 AM
Don't know if it counts but worked from home on our startup for a good 6 months or so before we got an office. Found it extremely challenging myself, getting an office and designating place of work improved my quality of life hugely. Biggest problem was separating home time from work time.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-12-2013 , 11:39 AM
Quote:
Originally Posted by jjshabado
Has anyone worked remotely for a long period of time?

I've done it for 3 years now and there are certain things that I'm finding more annoying than when I first started. Did you get burned out at it? Did you/Do you love it? General tips or complaints?
I played poker for 5 years and it def took its toll. It's nice to have the physical separation of work and home now.

My advice would be to have a dedicated space/room for work. Do not spend time inside this room outside your working hours. So no TV, couches etc. Don't eat your lunch there either.

Also invest in good ergonomic chair/keyboard/desk setup. I swear by this keyboard tray.



Makes a huge difference when working for 10+ hours in front of a computer.

Finally, my wife was not allowed in the room during working hours. I took conscious tea/snack breaks and had lunch together. But she was not allowed to bother me for petty/household type stuff during work hours
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-12-2013 , 12:10 PM
It's not so much the working from home part that bothers me. In fact I love that aspect. I have an office but I also move around the house quite a bit sometimes working on the couch or outside. I really like that if I'm feeling lazy at 3:30 I can start goofing off on the internet and then do another couple of productive hours at night.

It's more the working with other people aspect. I find meetings challenging because it can be hard to hear with lots of people talking kind of quickly, I find myself not knowing as much about whats going on, and I find it hard to contribute in different ways.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-12-2013 , 12:51 PM
Quote:
Originally Posted by jjshabado
Has anyone worked remotely for a long period of time?

I've done it for 3 years now and there are certain things that I'm finding more annoying than when I first started. Did you get burned out at it? Did you/Do you love it? General tips or complaints?
Is something terribly important going offices around the world? I don't really think so. I share an office with my Jack Rusell Terrier, who never complains and only asks for 2 walks a day and some ball-throwing time. Meanwhile my wife who works in an office is often stressed, and desperately trying to deal with elements of the rat race.

I've worked form home for 5 years with poker (playing PLO and mixed games) online, and since the end of 2011 have worked as programmer from home for fortune 500 and now a start-up that's based in Australia (while I live in MN).

I think it can feel sometimes like I'm not in the loop, but I've tried to become really good at writing letters and emails, as well meeting up with at least co-workers once a year. I feel like letters and face-to-face communication are the best form for communicating for me. We do the skype calls too, but I always feel like you can't get to the right level of discussion in the medium of p2p video, but it's good for beginning to raise new ideas or potential issues.

My main complaints would be people try to bring up the wrong type of discussion in meetings (it should be briefs) as well as the fact that generally people are terrible at writing emails.

If I'm feeling burned out or stuck, I go take a walk. My dog smiles, I feel better and I often just have the solution pop into my head along the way. Office workers are often stuck. Options are valuable--more so sometimes than money--and working from home is an awesome one I think
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-12-2013 , 01:10 PM
letters? like your print them out, put them in an envelope, and drop them in the mailbox?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-12-2013 , 01:30 PM
Quote:
Originally Posted by tyler_cracker
letters? like your print them out, put them in an envelope, and drop them in the mailbox?
No, I meant emails. I try and mostly treat email like people use to do when they wrote letters, rather than treating them like instant messaging. For instance, I often use the gmail boomerang plugin so emails will be sent at times that I know someone else won't be busy with something else. To IM users this is a crazy idea. But, to most people their email is their to-do list.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

      
m