Activity
Posted in Coffeescript Instantiation
Haha! Always the simplest things producing the hardest problems.
I would imagine so, but you'd probably want to ask on their Github issues to be sure. This is probably just more of a database configuration thing than anything with apartment or Rails.
Hey Francisco,
Sounds like you'd be better off making one User model and then adding roles to them instead with Rolify and Pundit. I'd definitely recommend doing this.
If you do want to keep the separate models, you have a couple options.
- You can have separate urls and they choose which type of user they are and get directed to the correct devise login URL.
- You could override the controller to search through each model to find the correct user. This solution gets pretty nasty quickly and isn't flexible for future changes. If you still want to do that, you can attempt something like this: http://blog.frankzhao.com.au/2014/12/single-sign-on-for-two-different-user-models-with-devise/
Yes you can! Just add that attribute to the company and you can use that.
I've wanted to open it up and share it and let you guys add features to the forum if you like. I haven't done it yet because I want to make sure I don't accidentally share API keys. There are a lot of old things that need cleaning up from how I originally built the site too.
Would you be interested in me sharing it?
Posted in Code Challenge idea
By all means, take a stab at something. I'm going to hack on simple_calendar I believe because I've got some requests for new features on it.
Are you guys interested in any specific kinds of challenges?
Posted in Code Challenge idea
Agreed. Maybe it's also a challenge to do open source every day? I've been thinking about doing that this past weekend and might start today.
PostGIS would be the easiest way to get started. There definitely isn't great documentation on it. Maybe I'll be able to record a screencast on it sometime soon.
In the meantime, check out the readme on this and see if it does what you need: https://github.com/rgeo/activerecord-postgis-adapter
That should be good. Cloudfront is a CDN so it caches files so you can download them faster around the world. It's something you have to configure so Ruby's website is probably forwarding you to that. Good to verify that it's not malicious in any case!
Are you considering using PostGIS on PostgreSQL for basic search or an independent search engine like ElasticSearch so you can do more complex searches?
Weird! In any case, nginx and unicorn are awesome so you'll be in good hands with that setup as well.
I've had some weirdness with Passenger 5 myself and have reverted back to using Puma for now.
Posted in Multi Site in Rails
Probably not if you don't have a database. The gem is designed for that, but you could write a before_action
that looks up the correct site as soon as the request starts. That would do basically the same thing as the Apartment gem. You'll just want something more custom in this case because what you're doing is a bit unique. The before_action should work great for this.
The best kinds of questions are the ones you ask and answer yourself shortly afterwards. <3
You can although if you're using a lot of libraries it can be slower to load files from many domains. Usually you want to compile and minimize them in your application.js/css and then serve it up through a CDN like Cloudfront.
Posted in Setup MacOS 10.10 Yosemite Discussion
Looks like you may not be using the Ruby (and the gem command) from the rbenv install. Try restarting your terminal and making sure you get something like "/Users/chris/.rbenv/shims/ruby" from running "which ruby"
Great question! That's what data attributes are really useful for.
You can just add data attributes like data-type="user"
to the a
tag. Then your JS can grab it with $(this).data("type")
and that will return the string "user" which you can simply plug into the string for the dialog.
Posted in Multi Site in Rails
This sounds like you're wanting to do a multi-tenant application basically. I did a couple episodes on this: https://gorails.com/episodes?utf8=%E2%9C%93&q%5Bname_or_description_or_notes_cont%5D=multiten
I imagine that you can use
@current_site
to load and render the correct theme without having to separate it into multiple controllers and actions. They could point to the same one and it dynamically figures out which to render.You won't need
Thread
for this because each request that comes in will have the domain in the request so it will be able to detect which site to render. Most Rails apps aren't actually threaded but the webserver is, so you don't have to worry about it.
Does it output any errors? I don't see anything here. Any other symptoms of what might be going wrong?
If you need to calculate the counts dynamically all the time, you won't be able to rely on a cache like this I don't think. You'll need to be recalculating the count as needed instead which means you'll have to store all the votes and when they happened so you can query those. It might be easiest to create an hourly cron job to update the user's votes for the day, week, month, etc.
Does that make sense?
Great question! I answered this on your forum post: https://gorails.com/forum/h...