Page 1 of 2 | Next »
[22:19:45] TheMonster: I want to create an enum that has one of the values called "new". is there a way to create it like that without causing conflict with the new method of the model?
[09:09:39] TheMonster: While trying to include attributes of a nested model in JSON, I used :include => :nested_model, can I have the attribute that shows that model :nested_model_attributes instead of :nested_model ? I want the update and get to be using same JSON format
[09:20:42] TheMonster: Solved my problem, not sure it's the best way but let me say it anyways: instead of :include I used :methods => :nested_model_attributes and defined nested_model_attributes to return nested_model
[15:55:45] TheMonster: rubyonrails372: as far as I know, Heroku doesn't delete the files after some time... It's just that it doesn't have a permanent storage option so you don't have a store
[15:56:44] TheMonster: just make sure to save your files and retrieve them from that permanent storage directory
[15:57:45] TheMonster: I think you mean when your dyno goes to sleep? that's because a new instance of the app is launched
[16:00:14] TheMonster: rubyonrails372: not if you put them in the public directory for example... There's a specific directory that keeps the files
[16:00:38] TheMonster: you need to find out its name... I can't remember it... It's present in an ENV variable
[13:29:30] TheMonster: If I'm using shallow nesting and I want to make a specific custom action be available for the nested version not the top one. How can I do that?
[13:05:43] TheMonster: I can say has_many :projects, through: :companies then say person.projects to get all projects of all companies. Is there a way to do a query person.companies.projects without that has_many?
[14:53:10] TheMonster: I can say has_many :projects, through: :companies then say person.projects to get all projects of all companies. Is there a way to do a query person.companies.projects without that has_many?
[10:56:53] TheMonster: For using the russian doll caching, if the model table didn't contain an updated_at column and it was just added lately so all values in it are nil, would things work correctly or I need to set updated_at for all rows to be Time.now or someting so that it works?
[11:17:08] TheMonster: Reasking: For using the russian doll caching, if the model table didn't contain an updated_at column and it was just added lately so all values in it are nil, would things work correctly or I need to set updated_at for all rows to be Time.now or someting so that it works?
[11:28:14] TheMonster: For using the russian doll caching, if the model table didn't contain an updated_at column and it was just added lately so all values in it are nil, would things work correctly or I need to set updated_at for all rows to be Time.now or someting so that it works?
[11:29:08] TheMonster: sevenseacat: sorry. Thought no one saw it and actually when I saw you writing thought you might know and haven't seen it. Sorry :(
[11:46:01] TheMonster: Just for the record. It seems that fragment caching works correctly when updated_at = nil, since I'm seeing lots of READ /views/fragments in the logs.
[12:03:34] TheMonster: Can I specify a condition for a scope where the condition is on an associated model. If my model belongs_to human, I want to say in the scope condition (self.human.male: true). Is that possible?
[12:28:44] TheMonster: Hi, when in my application I want to show some page that's something you see just after you log in that contains lists of different items from several models(Something like a dashboard). Should I just create a controller DashboardController with a single method in it? Is there a standard way to do something similar?
[12:42:43] TheMonster: fox_mulder_cp: Alright but what is the controller that's responsible for rendering the response?
[12:46:34] TheMonster: yes, I tried to Google but nothing really fits my use. Best suggestion I saw was to use something called WidgetsController whose index action would be the dashboard and the show would be giving a single (list of something) in response to AJAX calls for example
[12:50:12] TheMonster: tildes: actually after rethinking... I just reframed it to my case... I initially understood that this the suggestion was to use it for stats dashboards(so total aggregation)... When I said it here, I reframed it to my use... I got confused, this is what I should be using actually :D
[12:56:05] TheMonster: sevenseacat: Thanks :). I actually keep going back and forth every minute thinking that one of the approaches is better than the other and then going back
[13:31:55] TheMonster: Ah I see. I don't want to go that path right now though but thanks for the suggestion. I think it can be of help in the future :)
[15:23:44] TheMonster: Hi, say I have a Project model which has a public attribute set to true if the project is public, otherwise set to false. In the index method of the ProjectsController I want to show all projects that are public or belong to the current user(they are private to everyone but him). Is there a way to achieve that using default_scope(i.e without changing controller method)?
[19:47:52] TheMonster: if I'm using default Rails.cache, wouldn't it be concurrent for all threads running on Heroku? I'm trying to use it to prevent some race condition
[19:53:21] TheMonster: I want to prevent some controller method from entering a block and instead redirecting somewhere if that method is already being processed by another request with the same parameter value
[17:18:07] TheMonster: I want to apply this in a rails app: https://github.com/bluedragonz/bad-bot-blocker/blob/master/.htaccess
[17:18:30] TheMonster: I believe https://github.com/kickstarter/rack-attack is the way to do it. Is there a better way?
[11:17:02] TheMonster: Hi, is it possible to get raw SQL queries needed to create the database tables somehow from the schema.rb file? I want to get a query that I can write in phpMyAdmin to form the same database that will be formed when I do rake db:schema:load
[11:26:15] TheMonster: actually... After reading the link you linked to... kind is specific to the class in the guide... You should only use it if kind is an attribute of your class
[22:46:33] TheMonster: hello, I have a function that somehow feels... not elegent... Does anyone have an idea how I can make these types of functions better? http://pastie.org/10344930
[11:46:27] TheMonster: If I want to define a class that does some functions including calling methods inside some of the app models. Where should I put that class? lib folder? app/classes?
[11:51:38] TheMonster: My rspec tests sometimes fail with an "uninitialized constant ModelName" where ModelName is a defined Model... It sometimes fail and sometimes succeed... Can someone guess a reason of that?
[14:20:52] TheMonster: DylanJ: must be so distracting... It takes me time to context switch if I'm working on more than 1 project(Although usually not all projects are in the same language)
[14:22:43] TheMonster: aha... I'm still not used to vim and can't take the step of trying to get used to it :)
[22:23:43] TheMonster: Say I have some Issue model and I want to list issues in index depending on their state(closed or open for example). I had made a scope in the model (closed and still_open), now I used to do "Issues.send(params[:state])" in the controller which introduces security issues. What's the best alternative to do it?
[22:35:05] TheMonster: no, I like the built in scopes but in the controller I want to do Issues.send(params[:state]) for example but that's a security issue. Just wanted to know if there's a better way than writing a Where in the controller
[21:37:43] TheMonster: hello, I want to join file names similar to what File.join does but when I do File.join('','something'), the result is a string with '/' prefix. Is there a way/method to ignore empty strings?
[21:41:07] TheMonster: jhass: I provided the context... It's nothing private... If you could tell me what vague about 'Destination of a file'?
[03:49:57] TheMonster: while writing tests, if I want to test that the current path is equal to something, is it a good practice to use path helpers or should I write the link directly?
[09:45:12] TheMonster: is there a way to add an optional scope to members of resource and to embedded resources as well? look here: http://pastebin.com/DwkF0fti
[09:49:58] TheMonster: jhass:that worked but causes the scope to be before the id of the resource members. Isn't there a way to make it after them?
[09:52:00] TheMonster: jhass: yeah same thing issues... the scope is alright for things in the members but not for the nested resource
[09:56:09] TheMonster: jhass: http://pastie.org/private/vyt6flrkda8xvgcxxx63vw sorry for the messed line... I can't fix it ...
[20:51:45] TheMonster: Using Rugged gem, is there a way to walk through the history of a certain blob just seeing the commits where it was modified?
[18:49:31] TheMonster: ScottyKnows: I didn't see the discussion from the beginning, nor can I be of any help... Was just wondering $75-$150 per what, if I may ask that question?
[18:50:14] TheMonster: I'm guessing it's something related to RoR development and I want to know the range
[03:41:12] TheMonster: I've done lots of search so I'm kinda sure there'd be no answer but just in case there's something simple that I missed... Is there some gem that would allow one to make a git hosting server using Rails... Making something similar to Gitlab?
[03:44:33] TheMonster: alyyy: where should I put the git repositories to allow people to clone them? Putting them in the public folder doesn't work
[03:44:51] TheMonster: Radar: that's what I'm doing... Just wanted to make sure there's nothing simpler
[11:15:34] TheMonster: is there a way with a has_many relationship to append an object in one line? for example User.projects.append(@project) instead of doing User.projects << @project & User.save ?
[21:08:30] TheMonster: link_to "string", xx_path(@params) keeps encoding the linked to path... Is there a way to prevent that?
[21:10:41] TheMonster: smathy: for example if the linked to path contains "repository/myTest" it becomes "repositor%2FmyTest"
[21:42:33] TheMonster: balr0g: raises an unauthorized exception when the user can't do the action he's trying to do
[21:47:18] TheMonster: balr0g: are you sure you didn't rescue from that exception with a redirection to some page?
[22:00:34] TheMonster: balr0g: you can use current_user.can? to check for the ability inside a controller method and act accordingly
[22:04:48] TheMonster: balr0g: not entirely sure that the following is the best way but you can do: redirect_to 401_page_url, status: :unauthorized
[22:09:23] TheMonster: yeah... you can use an if/else then.... Again, I'm not sure this is the best way to do it
[11:18:23] TheMonster: if I have a /projects and /user/projects, is it better to have both routes map to the same controller method and have an if else in the controller or map the first to the index method and the second to a user_index method for example?
[23:06:50] TheMonster: if a user has many projects, and I want to have github like links: username/project_name... What should I do in the routes to be able to link to a project using project_path(@project) instead of project_user_path(@user,@project) ?
[23:09:19] TheMonster: Radar: I see. Thanks, but I think there should be a way to do it introduced in rails since the user object can be obtained from the project anyways.
[23:12:45] TheMonster: yeah that's what I'm doing :) Just suggesting that it might be better to introduce something in rails that would work for that
[23:16:31] TheMonster: yeah I get it... I was just thinking of something like scope :user_id do resources projects, that would be smart enough to detect it... I'm anyways doing it the helpers way after your suggestion. Thanks :)
[23:20:41] TheMonster: there's a lot of /:user/:project/... links that I don't want to keep writing that way
[23:29:26] TheMonster: I was just suggesting that if the project will always be linked to a certain user and I'll never link to "project" without user, that I expected Rails to find out the correct route for that project without having to explicitly passing the user... May be it was a bad idea nvm :)
[00:49:13] TheMonster: if I want to override a method in a model and make it do nothing, is there a better way than doing def method_name end ?
[21:42:47] TheMonster: microdex: I don't care about the cause... I just want to know what would be the response of the app if that happened